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 19 matching lines...) Expand all Loading... | |
| 30 treat_warnings_as_errors = true | 30 treat_warnings_as_errors = true |
| 31 | 31 |
| 32 # Normally, Android builds are lightly optimized, even for debug builds, to | 32 # Normally, Android builds are lightly optimized, even for debug builds, to |
| 33 # keep binary size down. Setting this flag to true disables such optimization | 33 # keep binary size down. Setting this flag to true disables such optimization |
| 34 android_full_debug = false | 34 android_full_debug = false |
| 35 | 35 |
| 36 # Whether to use the binary binutils checked into third_party/binutils. | 36 # Whether to use the binary binutils checked into third_party/binutils. |
| 37 # These are not multi-arch so cannot be used except on x86 and x86-64 (the | 37 # These are not multi-arch so cannot be used except on x86 and x86-64 (the |
| 38 # only two architectures that are currently checked in). Turn this off when | 38 # only two architectures that are currently checked in). Turn this off when |
| 39 # you are using a custom toolchain and need to control -B in cflags. | 39 # you are using a custom toolchain and need to control -B in cflags. |
| 40 linux_use_bundled_binutils = | 40 linux_use_bundled_binutils = |
|
Lei Zhang
2016/08/29 17:55:43
I'm happy this CL landed, but now I'm trying to ro
Nico
2016/08/29 17:56:50
I'd ask on gn-dev what best practice is supposed t
Dirk Pranke
2016/08/29 18:11:05
There's a number of different possible options, bu
| |
| 41 is_linux && (current_cpu == "x64" || current_cpu == "x86") | 41 is_linux && (current_cpu == "x64" || current_cpu == "x86") |
| 42 binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", | 42 binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", |
| 43 root_build_dir) | 43 root_build_dir) |
| 44 | 44 |
| 45 # Compile in such a way as to make it possible for the profiler to unwind full | 45 # Compile in such a way as to make it possible for the profiler to unwind full |
| 46 # stack frames. Setting this flag has a large effect on the performance of the | 46 # stack frames. Setting this flag has a large effect on the performance of the |
| 47 # generated code than just setting profiling, but gives the profiler more | 47 # generated code than just setting profiling, but gives the profiler more |
| 48 # information to analyze. | 48 # information to analyze. |
| 49 # Requires profiling to be set to true. | 49 # Requires profiling to be set to true. |
| 50 enable_full_stack_frames_for_profiling = false | 50 enable_full_stack_frames_for_profiling = false |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 | 201 |
| 202 # The x86 toolchain currently has problems with stack-protector. | 202 # The x86 toolchain currently has problems with stack-protector. |
| 203 if (is_android && current_cpu == "x86") { | 203 if (is_android && current_cpu == "x86") { |
| 204 cflags += [ "-fno-stack-protector" ] | 204 cflags += [ "-fno-stack-protector" ] |
| 205 } else { | 205 } else { |
| 206 cflags += [ "-fstack-protector" ] | 206 cflags += [ "-fstack-protector" ] |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 # Linker warnings. | 210 # Linker warnings. |
| 211 if ( fatal_linker_warnings && | 211 if (fatal_linker_warnings && !(is_chromeos && current_cpu == "arm") && |
| 212 !(is_chromeos && current_cpu == "arm") && | |
| 213 !(is_android && use_order_profiling) && !is_mac && !is_ios) { | 212 !(is_android && use_order_profiling) && !is_mac && !is_ios) { |
| 214 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 | 213 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 |
| 215 # TODO(lizeb,pasko): Fix link errors when linking with order_profiling=1 | 214 # TODO(lizeb,pasko): Fix link errors when linking with order_profiling=1 |
| 216 # crbug.com/485542 | 215 # crbug.com/485542 |
| 217 ldflags += [ "-Wl,--fatal-warnings" ] | 216 ldflags += [ "-Wl,--fatal-warnings" ] |
| 218 } | 217 } |
| 219 } | 218 } |
| 220 | 219 |
| 221 if (is_clang && is_debug) { | 220 if (is_clang && is_debug) { |
| 222 # Allow comparing the address of references and 'this' against 0 | 221 # Allow comparing the address of references and 'this' against 0 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 # Let clang find the ld.gold in the NDK. | 310 # Let clang find the ld.gold in the NDK. |
| 312 ldflags += [ "--gcc-toolchain=$_rebased_android_toolchain_root" ] | 311 ldflags += [ "--gcc-toolchain=$_rebased_android_toolchain_root" ] |
| 313 } | 312 } |
| 314 | 313 |
| 315 # Use -mstackrealign due to a bug on ia32 Jelly Bean. | 314 # Use -mstackrealign due to a bug on ia32 Jelly Bean. |
| 316 # See crbug.com/521527 | 315 # See crbug.com/521527 |
| 317 if (current_cpu == "x86") { | 316 if (current_cpu == "x86") { |
| 318 cflags += [ "-mstackrealign" ] | 317 cflags += [ "-mstackrealign" ] |
| 319 } | 318 } |
| 320 } else { | 319 } else { |
| 321 ldflags += [ | 320 ldflags += [ "-B$gold_path" ] |
| 322 "-B$gold_path", | 321 |
| 323 # Experimentation found that using four linking threads | 322 if (linux_use_bundled_binutils) { |
| 324 # saved ~20% of link time. | 323 ldflags += [ |
| 325 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thr ead/thread/281527606915bb36 | 324 # Experimentation found that using four linking threads |
| 326 # Only apply this to the target linker, since the host | 325 # saved ~20% of link time. |
| 327 # linker might not be gold, but isn't used much anyway. | 326 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_t hread/thread/281527606915bb36 |
| 328 # TODO(raymes): Disable threading because gold is frequently | 327 # Only apply this to the target linker, since the host |
| 329 # crashing on the bots: crbug.com/161942. | 328 # linker might not be gold, but isn't used much anyway. |
| 330 #"-Wl,--threads", | 329 "-Wl,--threads", |
| 331 #"-Wl,--thread-count=4", | 330 "-Wl,--thread-count=4", |
| 332 ] | 331 ] |
| 332 } | |
| 333 } | 333 } |
| 334 | 334 |
| 335 if (gdb_index) { | 335 if (gdb_index) { |
| 336 ldflags += [ "-Wl,--gdb-index" ] | 336 ldflags += [ "-Wl,--gdb-index" ] |
| 337 } | 337 } |
| 338 | 338 |
| 339 # TODO(thestig): Make this flag work with GN. | 339 # TODO(thestig): Make this flag work with GN. |
| 340 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan | | is_msan)) { | 340 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan | | is_msan)) { |
| 341 # ldflags += [ | 341 # ldflags += [ |
| 342 # "-Wl,--detect-odr-violations", | 342 # "-Wl,--detect-odr-violations", |
| (...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1566 | 1566 |
| 1567 if (is_ios || is_mac) { | 1567 if (is_ios || is_mac) { |
| 1568 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1568 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
| 1569 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1569 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
| 1570 config("enable_arc") { | 1570 config("enable_arc") { |
| 1571 common_flags = [ "-fobjc-arc" ] | 1571 common_flags = [ "-fobjc-arc" ] |
| 1572 cflags_objc = common_flags | 1572 cflags_objc = common_flags |
| 1573 cflags_objcc = common_flags | 1573 cflags_objcc = common_flags |
| 1574 } | 1574 } |
| 1575 } | 1575 } |
| OLD | NEW |