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 28 matching lines...) Expand all Loading... |
39 binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", | 39 binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", |
40 root_build_dir) | 40 root_build_dir) |
41 | 41 |
42 # Compile in such a way as to make it possible for the profiler to unwind full | 42 # Compile in such a way as to make it possible for the profiler to unwind full |
43 # stack frames. Setting this flag has a large effect on the performance of the | 43 # stack frames. Setting this flag has a large effect on the performance of the |
44 # generated code than just setting profiling, but gives the profiler more | 44 # generated code than just setting profiling, but gives the profiler more |
45 # information to analyze. | 45 # information to analyze. |
46 # Requires profiling to be set to true. | 46 # Requires profiling to be set to true. |
47 enable_full_stack_frames_for_profiling = false | 47 enable_full_stack_frames_for_profiling = false |
48 | 48 |
| 49 # TODO: We should be using 64-bit gold for linking on both 64-bit Linux |
| 50 # and 32-bit linux; 32-bit Gold runs out of address-space on 32-bit builds. |
| 51 # However, something isn't quite working right on the 32-bit builds. |
| 52 use_gold = |
| 53 is_linux && (current_cpu == "x64" || current_cpu == "arm") && !use_lld |
| 54 |
49 # When we are going to use gold we need to find it. | 55 # When we are going to use gold we need to find it. |
50 # This is initialized below, after use_gold might have been overridden. | 56 # This is initialized below, after use_gold might have been overridden. |
51 gold_path = false | 57 gold_path = false |
52 | 58 |
53 # use_debug_fission: whether to use split DWARF debug info | 59 # use_debug_fission: whether to use split DWARF debug info |
54 # files. This can reduce link time significantly, but is incompatible | 60 # files. This can reduce link time significantly, but is incompatible |
55 # with some utilities such as icecc and ccache. Requires gold and | 61 # with some utilities such as icecc and ccache. Requires gold and |
56 # gcc >= 4.8 or clang. | 62 # gcc >= 4.8 or clang. |
57 # http://gcc.gnu.org/wiki/DebugFission | 63 # http://gcc.gnu.org/wiki/DebugFission |
58 # | 64 # |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 if (!using_sanitizer && !use_cfi_diag) { | 297 if (!using_sanitizer && !use_cfi_diag) { |
292 ldflags += [ "-Wl,-z,defs" ] | 298 ldflags += [ "-Wl,-z,defs" ] |
293 } | 299 } |
294 } | 300 } |
295 | 301 |
296 # Linux-specific compiler flags setup. | 302 # Linux-specific compiler flags setup. |
297 # ------------------------------------ | 303 # ------------------------------------ |
298 if (is_posix && use_lld && !is_nacl) { | 304 if (is_posix && use_lld && !is_nacl) { |
299 ldflags += [ "-fuse-ld=lld" ] | 305 ldflags += [ "-fuse-ld=lld" ] |
300 } else if (use_gold) { | 306 } else if (use_gold) { |
301 ldflags += [ "-fuse-ld=gold" ] | 307 ldflags += [ |
302 if (is_android) { | 308 "-B$gold_path", |
303 if (is_clang) { | |
304 _rebased_android_toolchain_root = | |
305 rebase_path(android_toolchain_root, root_build_dir) | |
306 | 309 |
307 # Let clang find the ld.gold in the NDK. | 310 # Newer gccs and clangs support -fuse-ld, use the flag to force gold |
308 ldflags += [ "--gcc-toolchain=$_rebased_android_toolchain_root" ] | 311 # selection. |
309 } | 312 # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html |
| 313 "-fuse-ld=gold", |
310 | 314 |
311 # Use -mstackrealign due to a bug on ia32 Jelly Bean. | 315 # Experimentation found that using four linking threads |
312 # See crbug.com/521527 | 316 # saved ~20% of link time. |
313 if (current_cpu == "x86") { | 317 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_threa
d/thread/281527606915bb36 |
314 cflags += [ "-mstackrealign" ] | 318 # Only apply this to the target linker, since the host |
315 } | 319 # linker might not be gold, but isn't used much anyway. |
316 } else { | 320 # TODO(raymes): Disable threading because gold is frequently |
317 ldflags += [ | 321 # crashing on the bots: crbug.com/161942. |
318 "-B$gold_path", | 322 #"-Wl,--threads", |
319 # Experimentation found that using four linking threads | 323 #"-Wl,--thread-count=4", |
320 # saved ~20% of link time. | 324 ] |
321 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thr
ead/thread/281527606915bb36 | |
322 # Only apply this to the target linker, since the host | |
323 # linker might not be gold, but isn't used much anyway. | |
324 # TODO(raymes): Disable threading because gold is frequently | |
325 # crashing on the bots: crbug.com/161942. | |
326 #"-Wl,--threads", | |
327 #"-Wl,--thread-count=4", | |
328 ] | |
329 } | |
330 | 325 |
331 if (gdb_index) { | 326 if (gdb_index) { |
332 ldflags += [ "-Wl,--gdb-index" ] | 327 ldflags += [ "-Wl,--gdb-index" ] |
333 } | 328 } |
334 | 329 |
335 # TODO(thestig): Make this flag work with GN. | 330 # TODO(thestig): Make this flag work with GN. |
336 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan |
| is_msan)) { | 331 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan |
| is_msan)) { |
337 # ldflags += [ | 332 # ldflags += [ |
338 # "-Wl,--detect-odr-violations", | 333 # "-Wl,--detect-odr-violations", |
339 # ] | 334 # ] |
340 #} | 335 #} |
341 } else if (linux_use_bundled_binutils) { | 336 } else if (linux_use_bundled_binutils) { |
342 # Gold is the default linker for the bundled binutils so we explicitly | 337 # Gold is the default linker for the bundled binutils so we explicitly |
343 # enable the bfd linker when use_gold is not set. | 338 # enable the bfd linker when use_gold is not set. |
344 ldflags += [ "-fuse-ld=bfd" ] | 339 ldflags += [ "-fuse-ld=bfd" ] |
345 } else if (is_android && current_cpu == "mipsel" && is_clang) { | |
346 # Let clang find the ld.bfd in the NDK. | |
347 _rebased_android_toolchain_root = | |
348 rebase_path(android_toolchain_root, root_build_dir) | |
349 ldflags += [ "--gcc-toolchain=$rebased_android_toolchain_root" ] | |
350 } | 340 } |
351 | 341 |
352 if (is_posix && (use_gold || (use_lld && !is_nacl)) && !using_sanitizer && | 342 if (is_posix && (use_gold || (use_lld && !is_nacl)) && !using_sanitizer && |
353 !(is_android && use_order_profiling)) { | 343 !(is_android && use_order_profiling)) { |
354 # TODO(crbug.com/576197) - gcc on x86 platforms + gold + icf=all | 344 # TODO(crbug.com/576197) - gcc on x86 platforms + gold + icf=all |
355 # doesn't currently work. Once it does, use icf=all everywhere. | 345 # doesn't currently work. Once it does, use icf=all everywhere. |
356 if (is_clang || (target_cpu != "x86" && target_cpu != "x64")) { | 346 if (is_clang || (target_cpu != "x86" && target_cpu != "x64")) { |
357 ldflags += [ "-Wl,--icf=all" ] | 347 ldflags += [ "-Wl,--icf=all" ] |
358 } else { | 348 } else { |
359 ldflags += [ "-Wl,--icf=safe" ] | 349 ldflags += [ "-Wl,--icf=safe" ] |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 | 1465 |
1476 if (is_ios || is_mac) { | 1466 if (is_ios || is_mac) { |
1477 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1467 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1478 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1468 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1479 config("enable_arc") { | 1469 config("enable_arc") { |
1480 common_flags = [ "-fobjc-arc" ] | 1470 common_flags = [ "-fobjc-arc" ] |
1481 cflags_objc = common_flags | 1471 cflags_objc = common_flags |
1482 cflags_objcc = common_flags | 1472 cflags_objcc = common_flags |
1483 } | 1473 } |
1484 } | 1474 } |
OLD | NEW |