Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
| 6 import("//build/config/chrome_build.gni") | 6 import("//build/config/chrome_build.gni") |
| 7 import("//build/config/compiler/compiler.gni") | 7 import("//build/config/compiler/compiler.gni") |
| 8 import("//build/config/nacl/config.gni") | 8 import("//build/config/nacl/config.gni") |
| 9 import("//build/toolchain/cc_wrapper.gni") | 9 import("//build/toolchain/cc_wrapper.gni") |
| 10 import("//build/toolchain/toolchain.gni") | 10 import("//build/toolchain/toolchain.gni") |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 if (is_win) { | 154 if (is_win) { |
| 155 configs += [ "//build/config/win:compiler" ] | 155 configs += [ "//build/config/win:compiler" ] |
| 156 } else if (is_android) { | 156 } else if (is_android) { |
| 157 configs += [ "//build/config/android:compiler" ] | 157 configs += [ "//build/config/android:compiler" ] |
| 158 } else if (is_linux) { | 158 } else if (is_linux) { |
| 159 configs += [ "//build/config/linux:compiler" ] | 159 configs += [ "//build/config/linux:compiler" ] |
| 160 } else if (is_nacl) { | 160 } else if (is_nacl) { |
| 161 configs += [ "//build/config/nacl:compiler" ] | 161 configs += [ "//build/config/nacl:compiler" ] |
| 162 } else if (is_ios || is_mac) { | 162 } else if (is_ios || is_mac) { |
| 163 configs += [ "//build/config/mac:compiler" ] | 163 configs += [ "//build/config/mac:compiler" ] |
| 164 } else if (is_fuchsia) { | |
| 165 configs += [ "//build/config/fuchsia:compiler" ] | |
| 164 } | 166 } |
| 165 | 167 |
| 166 # Applies to all Posix systems. | 168 # Applies to all Posix systems. |
| 167 if (is_posix) { | 169 if (is_posix) { |
| 168 configs += [ "//build/config/posix:compiler" ] | 170 configs += [ "//build/config/posix:compiler" ] |
| 169 } | 171 } |
| 170 | 172 |
| 171 # See the definitions below. | 173 # See the definitions below. |
| 172 configs += [ | 174 configs += [ |
| 173 ":compiler_cpu_abi", | 175 ":compiler_cpu_abi", |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 ] | 293 ] |
| 292 defines += [ "NO_UNWIND_TABLES" ] | 294 defines += [ "NO_UNWIND_TABLES" ] |
| 293 } else { | 295 } else { |
| 294 cflags += [ "-funwind-tables" ] | 296 cflags += [ "-funwind-tables" ] |
| 295 } | 297 } |
| 296 } | 298 } |
| 297 } | 299 } |
| 298 | 300 |
| 299 # Linux/Android common flags setup. | 301 # Linux/Android common flags setup. |
| 300 # --------------------------------- | 302 # --------------------------------- |
| 301 if (is_linux || is_android) { | 303 if (is_linux || is_android || is_fuchsia) { |
| 302 cflags += [ | 304 cflags += [ |
| 303 "-fPIC", | 305 "-fPIC", |
| 304 "-pipe", # Use pipes for communicating between sub-processes. Faster. | 306 "-pipe", # Use pipes for communicating between sub-processes. Faster. |
| 305 ] | 307 ] |
| 306 | 308 |
| 307 ldflags += [ | 309 ldflags += [ |
| 308 "-fPIC", | 310 "-fPIC", |
| 309 "-Wl,-z,noexecstack", | 311 "-Wl,-z,noexecstack", |
| 310 "-Wl,-z,now", | 312 "-Wl,-z,now", |
| 311 "-Wl,-z,relro", | 313 "-Wl,-z,relro", |
| 312 ] | 314 ] |
| 313 if (!using_sanitizer) { | 315 if (!using_sanitizer) { |
| 314 if (!use_cfi_diag) { | 316 if (!use_cfi_diag) { |
| 315 ldflags += [ "-Wl,-z,defs" ] | 317 ldflags += [ "-Wl,-z,defs" ] |
| 316 } | 318 } |
| 317 | 319 |
| 318 # Functions interposed by the sanitizers can make ld think | 320 # Functions interposed by the sanitizers can make ld think |
| 319 # that some libraries aren't needed when they actually are, | 321 # that some libraries aren't needed when they actually are, |
| 320 # http://crbug.com/234010. As workaround, disable --as-needed. | 322 # http://crbug.com/234010. As workaround, disable --as-needed. |
| 321 if (!is_nacl && !is_android) { | 323 if (!is_nacl && !is_android) { |
| 322 # TODO(pcc): Fix linker bug which requires us to link pthread | 324 # TODO(pcc): Fix linker bug which requires us to link pthread |
| 323 # unconditionally here (crbug.com/623236). | 325 # unconditionally here (crbug.com/623236). |
| 324 ldflags += [ | 326 ldflags += [ |
| 325 "-Wl,--no-as-needed", | 327 "-Wl,--no-as-needed", |
| 326 "-lpthread", | 328 "-lpthread", |
| 327 ] | 329 ] |
| 328 } | 330 } |
| 329 ldflags += [ "-Wl,--as-needed" ] | 331 if (!is_fuchsia) { |
| 332 # We need mxio/magenta to get linked in, even if they're not directly | |
| 333 # referenced. | |
| 334 ldflags += [ "-Wl,--as-needed" ] | |
|
jamesr
2017/02/18 00:55:28
recording for posterity: you can have this flag, t
| |
| 335 } | |
| 330 } | 336 } |
| 331 } | 337 } |
| 332 | 338 |
| 333 # Linux-specific compiler flags setup. | 339 # Linux-specific compiler flags setup. |
| 334 # ------------------------------------ | 340 # ------------------------------------ |
| 335 if (is_android && is_clang) { | 341 if (is_android && is_clang) { |
| 336 _rebased_android_toolchain_root = | 342 _rebased_android_toolchain_root = |
| 337 rebase_path(android_toolchain_root, root_build_dir) | 343 rebase_path(android_toolchain_root, root_build_dir) |
| 338 | 344 |
| 339 # Let clang find the linker in the NDK. | 345 # Let clang find the linker in the NDK. |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1698 | 1704 |
| 1699 if (is_ios || is_mac) { | 1705 if (is_ios || is_mac) { |
| 1700 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1706 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
| 1701 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1707 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
| 1702 config("enable_arc") { | 1708 config("enable_arc") { |
| 1703 common_flags = [ "-fobjc-arc" ] | 1709 common_flags = [ "-fobjc-arc" ] |
| 1704 cflags_objc = common_flags | 1710 cflags_objc = common_flags |
| 1705 cflags_objcc = common_flags | 1711 cflags_objcc = common_flags |
| 1706 } | 1712 } |
| 1707 } | 1713 } |
| OLD | NEW |