| Index: build/config/compiler/BUILD.gn
|
| diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
|
| index 3f82d79abc76920af0ce9c69f9fa26b71a08e09c..ea6a23447fa19f909631c5db0f3c127f67c54e23 100644
|
| --- a/build/config/compiler/BUILD.gn
|
| +++ b/build/config/compiler/BUILD.gn
|
| @@ -46,11 +46,6 @@ declare_args() {
|
| # Requires profiling to be set to true.
|
| enable_full_stack_frames_for_profiling = false
|
|
|
| - # Whether to use the gold linker from binutils instead of lld or bfd.
|
| - use_gold =
|
| - !use_lld && is_linux &&
|
| - (current_cpu == "x64" || current_cpu == "x86" || current_cpu == "arm")
|
| -
|
| # When we are going to use gold we need to find it.
|
| # This is initialized below, after use_gold might have been overridden.
|
| gold_path = false
|
| @@ -303,24 +298,35 @@ config("compiler") {
|
| if (is_posix && use_lld && !is_nacl) {
|
| ldflags += [ "-fuse-ld=lld" ]
|
| } else if (use_gold) {
|
| - ldflags += [
|
| - "-B$gold_path",
|
| -
|
| - # Newer gccs and clangs support -fuse-ld, use the flag to force gold
|
| - # selection.
|
| - # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html
|
| - "-fuse-ld=gold",
|
| -
|
| - # Experimentation found that using four linking threads
|
| - # saved ~20% of link time.
|
| - # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
|
| - # Only apply this to the target linker, since the host
|
| - # linker might not be gold, but isn't used much anyway.
|
| - # TODO(raymes): Disable threading because gold is frequently
|
| - # crashing on the bots: crbug.com/161942.
|
| - #"-Wl,--threads",
|
| - #"-Wl,--thread-count=4",
|
| - ]
|
| + ldflags += [ "-fuse-ld=gold" ]
|
| + if (is_android) {
|
| + if (is_clang) {
|
| + _rebased_android_toolchain_root =
|
| + rebase_path(android_toolchain_root, root_build_dir)
|
| +
|
| + # Let clang find the ld.gold in the NDK.
|
| + ldflags += [ "--gcc-toolchain=$_rebased_android_toolchain_root" ]
|
| + }
|
| +
|
| + # Use -mstackrealign due to a bug on ia32 Jelly Bean.
|
| + # See crbug.com/521527
|
| + if (current_cpu == "x86") {
|
| + cflags += [ "-mstackrealign" ]
|
| + }
|
| + } else {
|
| + ldflags += [
|
| + "-B$gold_path",
|
| + # Experimentation found that using four linking threads
|
| + # saved ~20% of link time.
|
| + # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
|
| + # Only apply this to the target linker, since the host
|
| + # linker might not be gold, but isn't used much anyway.
|
| + # TODO(raymes): Disable threading because gold is frequently
|
| + # crashing on the bots: crbug.com/161942.
|
| + #"-Wl,--threads",
|
| + #"-Wl,--thread-count=4",
|
| + ]
|
| + }
|
|
|
| if (gdb_index) {
|
| ldflags += [ "-Wl,--gdb-index" ]
|
| @@ -336,15 +342,21 @@ config("compiler") {
|
| # Gold is the default linker for the bundled binutils so we explicitly
|
| # enable the bfd linker when use_gold is not set.
|
| ldflags += [ "-fuse-ld=bfd" ]
|
| + } else if (is_android && current_cpu == "mipsel" && is_clang) {
|
| + # Let clang find the ld.bfd in the NDK.
|
| + _rebased_android_toolchain_root =
|
| + rebase_path(android_toolchain_root, root_build_dir)
|
| + ldflags += [ "--gcc-toolchain=$rebased_android_toolchain_root" ]
|
| }
|
|
|
| if (is_posix && (use_gold || (use_lld && !is_nacl)) && !using_sanitizer &&
|
| !(is_android && use_order_profiling)) {
|
| # TODO(crbug.com/576197) - gcc on x86 platforms + gold + icf=all
|
| # doesn't currently work. Once it does, use icf=all everywhere.
|
| + # Additionally, on Android x86 --icf=safe seems to cause issues as well.
|
| if (is_clang || (target_cpu != "x86" && target_cpu != "x64")) {
|
| ldflags += [ "-Wl,--icf=all" ]
|
| - } else {
|
| + } else if (!is_android) {
|
| ldflags += [ "-Wl,--icf=safe" ]
|
| }
|
| }
|
|
|