diff options
author | thegeorg <thegeorg@yandex-team.ru> | 2022-05-16 16:18:40 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.ru> | 2022-05-16 16:18:40 +0300 |
commit | 5e43bd290eea0c0799394c484e7c77ccd452eba8 (patch) | |
tree | df8484d8a419ee4c3a438eea0ffad9a725bd869e /build | |
parent | ca04e360f54a3601b44d9227ad5898a14bc69b73 (diff) | |
download | ydb-5e43bd290eea0c0799394c484e7c77ccd452eba8.tar.gz |
Use lld linker on Linux unless USE_LINKER_GOLD() is explicitly specified
* Drop heuristical switching to gold when compiling with gcc and musl
* Drop `USE_LINKER_BFD()` and `USE_LINKER_LLD()` macros.
* User can still request to `USE_LINKER_GOLD()`, as it is capable to workaround _relocation out of range_ problem in certain cases.
ref:3c5181f8be6eb35067f5cfe14aad3e7d2a1748eb
Diffstat (limited to 'build')
-rw-r--r-- | build/conf/linkers/ld.conf | 6 | ||||
-rw-r--r-- | build/ymake.core.conf | 16 | ||||
-rwxr-xr-x | build/ymake_conf.py | 18 |
3 files changed, 4 insertions, 36 deletions
diff --git a/build/conf/linkers/ld.conf b/build/conf/linkers/ld.conf index ede939564b..90f548edbf 100644 --- a/build/conf/linkers/ld.conf +++ b/build/conf/linkers/ld.conf @@ -2,12 +2,6 @@ _LD_FLAGS_1= _LD_FLAGS_2= when ($MUSL == "yes") { _LD_FLAGS_1=-Wl,--no-as-needed - when ($GCC == "yes") { - # MUSL_BFD: musl build uses --no-dynamic-linker linker flag - # which gold doesn't know about. And we can only specify linker - # type, not it's path as we do for Clang through linker selector. - _LD_FLAGS_2=-fuse-ld=bfd - } } elsewhen ($OS_LINUX == "yes") { _LD_FLAGS_1=-ldl -lrt -Wl,--no-as-needed diff --git a/build/ymake.core.conf b/build/ymake.core.conf index fd28f422bf..de54cf09ed 100644 --- a/build/ymake.core.conf +++ b/build/ymake.core.conf @@ -1435,10 +1435,10 @@ module _BASE_UNIT: _BARE_UNIT { } _LINKER_ID= -# GCC does not support -fuse-ld with an executable path, only -# -fuse-ld=bfd or -fuse-ld=gold (or -fuse-ld=lld in later versions). +# GCC does not support -fuse-ld with an executable path, +# only -fuse-ld=gold or -fuse-ld=lld. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") { - when ($_LINKER_ID in [ "bfd", "gold", "lld" ]) { + when ($_LINKER_ID in [ "gold", "lld" ]) { PEERDIR+=build/platform/${_LINKER_ID} } } @@ -1451,21 +1451,11 @@ macro _USE_LINKER() { _USE_LINKER_IMPL($_DEFAULT_LINKER_ID) } -### @usage: USE_LINKER_BFD() -### Use bfd linker for a program. This doesn't work in libraries -macro USE_LINKER_BFD() { - _USE_LINKER_IMPL(bfd) -} ### @usage: USE_LINKER_GOLD() ### Use gold linker for a program. This doesn't work in libraries macro USE_LINKER_GOLD() { _USE_LINKER_IMPL(gold) } -### @usage: USE_LINKER_LLD() -### Use lld linker for a program. This doesn't work in libraries -macro USE_LINKER_LLD() { - _USE_LINKER_IMPL(lld) -} COMMON_LINK_SETTINGS= LINK_ADDITIONAL_SECTIONS= diff --git a/build/ymake_conf.py b/build/ymake_conf.py index 173eab7ad0..fd06591d8e 100755 --- a/build/ymake_conf.py +++ b/build/ymake_conf.py @@ -1779,18 +1779,7 @@ class Linker(object): return Linker.LLD elif self.build.target.is_linux: - # DEVTOOLS-6782: LLD8 fails to link LTO builds with in-memory ELF objects larger than 4 GiB - blacklist_lld = is_positive('CLANG7') and is_positive('USE_LTO') and not is_positive('MUSL') - if self.tc.is_clang and not blacklist_lld: - return Linker.LLD - else: - # GCC et al. - - if self.tc.is_gcc and is_positive('MUSL'): - # See MUSL_BFD comment below - return Linker.BFD - - return Linker.GOLD + return Linker.LLD # There is no linker choice on Darwin (ld64) or Windows (link.exe) return None @@ -1882,11 +1871,6 @@ class LD(Linker): if self.musl.value: self.ld_flags.extend(['-Wl,--no-as-needed']) - if self.tc.is_gcc: - # MUSL_BFD: musl build uses --no-dynamic-linker linker flag - # which gold doesn't know about. And we can only specify linker - # type, not it's path as we do for Clang through linker selector. - self.ld_flags.append('-fuse-ld=bfd') elif target.is_linux: self.ld_flags.extend(['-ldl', '-lrt', '-Wl,--no-as-needed']) if self.tc.is_gcc: |