Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: build/config/compiler/BUILD.gn

Issue 1972183003: 👻 Merge android's use_gold settings with the main use_gold GN arg logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move use_gold toolchain.gni -> compiler.gni Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/android/BUILD.gn ('k') | build/config/compiler/compiler.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 27 matching lines...) Expand all
38 binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", 38 binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin",
39 root_build_dir) 39 root_build_dir)
40 40
41 # Compile in such a way as to make it possible for the profiler to unwind full 41 # Compile in such a way as to make it possible for the profiler to unwind full
42 # stack frames. Setting this flag has a large effect on the performance of the 42 # stack frames. Setting this flag has a large effect on the performance of the
43 # generated code than just setting profiling, but gives the profiler more 43 # generated code than just setting profiling, but gives the profiler more
44 # information to analyze. 44 # information to analyze.
45 # Requires profiling to be set to true. 45 # Requires profiling to be set to true.
46 enable_full_stack_frames_for_profiling = false 46 enable_full_stack_frames_for_profiling = false
47 47
48 # TODO: We should be using 64-bit gold for linking on both 64-bit Linux
49 # and 32-bit linux; 32-bit Gold runs out of address-space on 32-bit builds.
50 # However, something isn't quite working right on the 32-bit builds.
51 use_gold =
52 is_linux && (current_cpu == "x64" || current_cpu == "arm") && !use_lld
53
54 # When we are going to use gold we need to find it. 48 # When we are going to use gold we need to find it.
55 # This is initialized below, after use_gold might have been overridden. 49 # This is initialized below, after use_gold might have been overridden.
56 gold_path = false 50 gold_path = false
57 51
58 # use_debug_fission: whether to use split DWARF debug info 52 # use_debug_fission: whether to use split DWARF debug info
59 # files. This can reduce link time significantly, but is incompatible 53 # files. This can reduce link time significantly, but is incompatible
60 # with some utilities such as icecc and ccache. Requires gold and 54 # with some utilities such as icecc and ccache. Requires gold and
61 # gcc >= 4.8 or clang. 55 # gcc >= 4.8 or clang.
62 # http://gcc.gnu.org/wiki/DebugFission 56 # http://gcc.gnu.org/wiki/DebugFission
63 # 57 #
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 if (!using_sanitizer && !use_cfi_diag) { 288 if (!using_sanitizer && !use_cfi_diag) {
295 ldflags += [ "-Wl,-z,defs" ] 289 ldflags += [ "-Wl,-z,defs" ]
296 } 290 }
297 } 291 }
298 292
299 # Linux-specific compiler flags setup. 293 # Linux-specific compiler flags setup.
300 # ------------------------------------ 294 # ------------------------------------
301 if (is_posix && use_lld && !is_nacl) { 295 if (is_posix && use_lld && !is_nacl) {
302 ldflags += [ "-fuse-ld=lld" ] 296 ldflags += [ "-fuse-ld=lld" ]
303 } else if (use_gold) { 297 } else if (use_gold) {
304 ldflags += [ 298 ldflags += [ "-fuse-ld=gold" ]
305 "-B$gold_path", 299 if (is_android) {
300 if (is_clang) {
301 _rebased_android_toolchain_root =
302 rebase_path(android_toolchain_root, root_build_dir)
306 303
307 # Newer gccs and clangs support -fuse-ld, use the flag to force gold 304 # Let clang find the ld.gold in the NDK.
308 # selection. 305 ldflags += [ "--gcc-toolchain=$_rebased_android_toolchain_root" ]
309 # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html 306 }
310 "-fuse-ld=gold",
311 307
312 # Experimentation found that using four linking threads 308 # Use -mstackrealign due to a bug on ia32 Jelly Bean.
313 # saved ~20% of link time. 309 # See crbug.com/521527
314 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_threa d/thread/281527606915bb36 310 if (current_cpu == "x86") {
315 # Only apply this to the target linker, since the host 311 cflags += [ "-mstackrealign" ]
316 # linker might not be gold, but isn't used much anyway. 312 }
317 # TODO(raymes): Disable threading because gold is frequently 313 } else {
318 # crashing on the bots: crbug.com/161942. 314 ldflags += [
319 #"-Wl,--threads", 315 "-B$gold_path",
320 #"-Wl,--thread-count=4", 316 # Experimentation found that using four linking threads
321 ] 317 # saved ~20% of link time.
318 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thr ead/thread/281527606915bb36
319 # Only apply this to the target linker, since the host
320 # linker might not be gold, but isn't used much anyway.
321 # TODO(raymes): Disable threading because gold is frequently
322 # crashing on the bots: crbug.com/161942.
323 #"-Wl,--threads",
324 #"-Wl,--thread-count=4",
325 ]
326 }
322 327
323 if (gdb_index) { 328 if (gdb_index) {
324 ldflags += [ "-Wl,--gdb-index" ] 329 ldflags += [ "-Wl,--gdb-index" ]
325 } 330 }
326 331
327 # TODO(thestig): Make this flag work with GN. 332 # TODO(thestig): Make this flag work with GN.
328 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan | | is_msan)) { 333 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan | | is_msan)) {
329 # ldflags += [ 334 # ldflags += [
330 # "-Wl,--detect-odr-violations", 335 # "-Wl,--detect-odr-violations",
331 # ] 336 # ]
332 #} 337 #}
333 } else if (linux_use_bundled_binutils) { 338 } else if (linux_use_bundled_binutils) {
334 # Gold is the default linker for the bundled binutils so we explicitly 339 # Gold is the default linker for the bundled binutils so we explicitly
335 # enable the bfd linker when use_gold is not set. 340 # enable the bfd linker when use_gold is not set.
336 ldflags += [ "-fuse-ld=bfd" ] 341 ldflags += [ "-fuse-ld=bfd" ]
342 } else if (is_android && current_cpu == "mipsel" && is_clang) {
343 # Let clang find the ld.bfd in the NDK.
344 _rebased_android_toolchain_root =
345 rebase_path(android_toolchain_root, root_build_dir)
346 ldflags += [ "--gcc-toolchain=$rebased_android_toolchain_root" ]
337 } 347 }
338 348
339 if (is_posix && (use_gold || (use_lld && !is_nacl)) && !using_sanitizer && 349 if (is_posix && (use_gold || (use_lld && !is_nacl)) && !using_sanitizer &&
340 !(is_android && use_order_profiling)) { 350 !(is_android && use_order_profiling)) {
341 ldflags += [ "-Wl,--icf=all" ] 351 ldflags += [ "-Wl,--icf=all" ]
342 } 352 }
343 353
344 if (linux_use_bundled_binutils) { 354 if (linux_use_bundled_binutils) {
345 cflags += [ "-B$binutils_path" ] 355 cflags += [ "-B$binutils_path" ]
346 } 356 }
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 1463
1454 if (is_ios || is_mac) { 1464 if (is_ios || is_mac) {
1455 # On Mac and iOS, this enables support for ARC (automatic ref-counting). 1465 # On Mac and iOS, this enables support for ARC (automatic ref-counting).
1456 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. 1466 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html.
1457 config("enable_arc") { 1467 config("enable_arc") {
1458 common_flags = [ "-fobjc-arc" ] 1468 common_flags = [ "-fobjc-arc" ]
1459 cflags_objc = common_flags 1469 cflags_objc = common_flags
1460 cflags_objcc = common_flags 1470 cflags_objcc = common_flags
1461 } 1471 }
1462 } 1472 }
OLDNEW
« no previous file with comments | « build/config/android/BUILD.gn ('k') | build/config/compiler/compiler.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698