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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/config/android/BUILD.gn ('k') | build/config/compiler/compiler.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/compiler/BUILD.gn
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 0ae9cb050a36a34bdb61a35075d5584347a4264b..3e8fa48b6d17c469dfd9314e7a9df3e27d5880c9 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -45,12 +45,6 @@ declare_args() {
# Requires profiling to be set to true.
enable_full_stack_frames_for_profiling = false
- # TODO: We should be using 64-bit gold for linking on both 64-bit Linux
- # and 32-bit linux; 32-bit Gold runs out of address-space on 32-bit builds.
- # However, something isn't quite working right on the 32-bit builds.
- use_gold =
- is_linux && (current_cpu == "x64" || current_cpu == "arm") && !use_lld
-
# 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
@@ -301,24 +295,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" ]
@@ -334,6 +339,11 @@ 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 &&
« 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