From 37c4e7670d3c122ba4ab7aa932ba79825882de53 Mon Sep 17 00:00:00 2001 From: thakis Date: Tue, 26 Aug 2014 07:54:36 -0700 Subject: [PATCH] linux: Always use (64bit) gold for linking, even on 32bit. All 32bit bots now have 64bit kernels and can run 64bit gold. So always use that. We already require running 64bit binaries for clang, and the official bots already used to do this for gold. This makes linking on 32bit bots faster, and simplifies our configurations. BUG=396333 TBR=brettw Review URL: https://codereview.chromium.org/503873004 Cr-Original-Commit-Position: refs/heads/master@{#291904} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 7cd5e7a3a82ebad8bf53e1236229d1094f8dafc6 --- common.gypi | 41 +++++++--------------------------------- config/compiler/BUILD.gn | 6 +++--- 2 files changed, 10 insertions(+), 37 deletions(-) diff --git a/common.gypi b/common.gypi index d5d5a5960..ecf9bcfbb 100644 --- a/common.gypi +++ b/common.gypi @@ -809,9 +809,9 @@ # 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")', { + # 32-bit hosts have to be 32-bit userland with a 64-bit kernel, so that + # 64-bit gold gets used. 32-bit gold will run out of address space. + ['OS=="linux"', { 'linux_use_bundled_gold%': 1, }, { 'linux_use_bundled_gold%': 0, @@ -820,7 +820,7 @@ # 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 currently checked 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=="x64")', { 'linux_use_bundled_binutils%': 1, @@ -1488,6 +1488,9 @@ }], # Get binutils version so we can enable debug fission if we can. ['os_posix==1 and OS!="mac" and OS!="ios"', { + # 32-bit hosts have to be 32-bit userland with a 64-bit kernel, so that + # 64-bit gold gets used. 32-bit gold will run out of address space. + 'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin', 'conditions': [ # compiler_version doesn't work with clang # TODO(mithro): Land https://codereview.chromium.org/199793014/ so @@ -1501,12 +1504,6 @@ ['OS=="android"', { 'binutils_version%': 222, }], - ['host_arch=="x64"', { - 'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin', - }], - ['host_arch=="ia32"', { - 'binutils_dir%': 'third_party/binutils/Linux_ia32/Release/bin', - }], # Our version of binutils in third_party/binutils ['linux_use_bundled_binutils==1', { 'binutils_version%': 224, @@ -1579,16 +1576,6 @@ # Omit unwind support in official release builds to save space. We # can use breakpad for these builds. 'release_unwind_tables%': 0, - - 'conditions': [ - # For official builds, use a 64-bit linker to avoid running out - # of address space. The buildbots should have a 64-bit kernel - # and a 64-bit libc installed. - ['host_arch=="ia32" and target_arch=="ia32"', { - 'linux_use_bundled_gold%': '1', - 'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin', - }], - ], }], ], }], # os_posix==1 and OS!="mac" and OS!="ios" @@ -4204,20 +4191,6 @@ }], ['linux_dump_symbols==1', { 'cflags': [ '-g' ], - 'conditions': [ - ['OS=="linux" and host_arch=="ia32" and linux_use_bundled_gold==0', { - 'target_conditions': [ - ['_toolset=="target"', { - 'ldflags': [ - # Attempt to use less memory to prevent the linker from - # running out of address space. Considering installing a - # 64-bit kernel and switching to a 64-bit linker. - '-Wl,--no-keep-memory', - ], - }], - ], - }], - ], }], ['use_allocator!="tcmalloc"', { 'defines': ['NO_TCMALLOC'], diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn index 33d52db4d..9b66b9cb3 100644 --- a/config/compiler/BUILD.gn +++ b/config/compiler/BUILD.gn @@ -16,7 +16,7 @@ declare_args() { android_full_debug = false } -use_gold = is_linux && cpu_arch == "x64" +use_gold = is_linux # linux_use_debug_fission: whether to use split DWARF debug info # files. This can reduce link time significantly, but is incompatible @@ -200,8 +200,8 @@ config("compiler") { ] } if (use_gold) { - # Use gold for linking on 64-bit Linux only (on 32-bit it runs out of - # address space, and it doesn't support cross-compiling). + # 32-bit hosts have to be 32-bit userland with a 64-bit kernel, so that + # 64-bit gold gets used. 32-bit gold will run out of address space. gold_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", root_build_dir) ldflags += [