Index: build/toolchain.gypi |
diff --git a/build/toolchain.gypi b/build/toolchain.gypi |
index e0d6d7452e852bc66f8edc10e7c83e46c25a5566..dfaffd05d26540fbc89208b616eeb6a4d6561cf5 100644 |
--- a/build/toolchain.gypi |
+++ b/build/toolchain.gypi |
@@ -86,6 +86,46 @@ |
# Allow to suppress the array bounds warning (default is no suppression). |
'wno_array_bounds%': '', |
+ # Override where to find binutils |
+ 'binutils_dir%': '', |
+ |
+ 'conditions': [ |
+ ['OS=="linux" and host_arch=="x64"', { |
+ 'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin', |
+ }], |
+ ['OS=="linux" and host_arch=="ia32"', { |
+ 'binutils_dir%': 'third_party/binutils/Linux_ia32/Release/bin', |
+ }], |
+ |
+ # linux_use_bundled_gold: whether to use the gold linker binary checked |
+ # into third_party/binutils. Force this off via GYP_DEFINES when you |
+ # are using a custom toolchain and need to control -B in ldflags. |
+ # Do not use 32-bit gold on 32-bit hosts as it runs out address space |
+ # for component=static_library builds. |
+ ['OS=="linux" and (target_arch=="x64" or target_arch=="arm")', { |
+ 'linux_use_bundled_gold%': 1, |
+ }, { |
+ 'linux_use_bundled_gold%': 0, |
+ }], |
+ # linux_use_bundled_binutils: whether to use the binary binutils |
+ # checked into third_party/binutils. These are not multi-arch so cannot |
+ # be used except on x86 and x86-64 (the only two architectures which |
+ # are currently checke in). Force this off via GYP_DEFINES when you |
+ # are using a custom toolchain and need to control -B in cflags. |
+ ['OS=="linux" and (target_arch=="ia32" or target_arch=="x64")', { |
+ 'linux_use_bundled_binutils%': 1, |
+ }, { |
+ 'linux_use_bundled_binutils%': 0, |
+ }], |
+ # linux_use_gold_flags: whether to use build flags that rely on gold. |
+ # On by default for x64 Linux. |
+ ['OS=="linux" and target_arch=="x64"', { |
+ 'linux_use_gold_flags%': 1, |
+ }, { |
+ 'linux_use_gold_flags%': 0, |
+ }], |
+ ], |
+ |
# Link-Time Optimizations |
'use_lto%': 0, |
@@ -797,6 +837,26 @@ |
'-mx32', |
], |
}], # v8_target_arch=="x32" |
+ ['linux_use_gold_flags==1', { |
+ # 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 |
+ 'ldflags': [ '-fuse-ld=gold', ], |
+ }], |
+ ['linux_use_bundled_binutils==1', { |
+ 'cflags': [ |
+ '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)', |
+ ], |
+ }], |
+ ['linux_use_bundled_gold==1', { |
+ # Put our binutils, which contains gold in the search path. We pass |
+ # the path to gold to the compiler. gyp leaves unspecified what the |
+ # cwd is when running the compiler, so the normal gyp path-munging |
+ # fails us. This hack gets the right path. |
+ 'ldflags': [ |
+ '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)', |
+ ], |
+ }], |
['OS=="win"', { |
'defines': [ |
'WIN32', |
@@ -1083,6 +1143,21 @@ |
}], |
], |
}], |
+ ['linux_use_gold_flags==1', { |
+ 'target_conditions': [ |
+ ['_toolset=="target"', { |
+ 'ldflags': [ |
+ # 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. |
+ '-Wl,--threads', |
+ '-Wl,--thread-count=4', |
+ ], |
+ }], |
+ ], |
+ }], |
], |
}, # DebugBaseCommon |
'Debug': { |