[clang] 95dcaef - [Driver][Linux] Pass --hash-style=gnu to ld unless special cased
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 28 12:13:11 PDT 2022
Author: Fangrui Song
Date: 2022-08-28T12:13:01-07:00
New Revision: 95dcaef00379e893dabc61cf598fe51c9d03414e
URL: https://github.com/llvm/llvm-project/commit/95dcaef00379e893dabc61cf598fe51c9d03414e
DIFF: https://github.com/llvm/llvm-project/commit/95dcaef00379e893dabc61cf598fe51c9d03414e.diff
LOG: [Driver][Linux] Pass --hash-style=gnu to ld unless special cased
To align with many Linux distributions which configure GCC with
--enable-default-hash-style=gnu or binutils with --with-linker-hash-style=gnu.
ld.lld does not support changed default, so passing the option in the driver is
better.
Note: there was a bug that Debian specified both --hash-style=gnu and
--hash-style=both. Actually its GCC has defaulted to --hash-style=gnu since 2007.
Added:
Modified:
clang/lib/Driver/ToolChains/Linux.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 169daa8e4b49..756994aeba1c 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -239,16 +239,12 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
// Android loader does not support .gnu.hash until API 23.
// Hexagon linker/loader does not support .gnu.hash
if (!IsMips && !IsHexagon) {
- if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
- (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) ||
- (IsAndroid && !Triple.isAndroidVersionLT(23)))
- ExtraOpts.push_back("--hash-style=gnu");
-
- if (Distro.IsDebian() || Distro.IsOpenSUSE() ||
- Distro == Distro::UbuntuLucid || Distro == Distro::UbuntuJaunty ||
- Distro == Distro::UbuntuKarmic ||
+ if (Distro.IsOpenSUSE() || Distro == Distro::UbuntuLucid ||
+ Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic ||
(IsAndroid && Triple.isAndroidVersionLT(23)))
ExtraOpts.push_back("--hash-style=both");
+ else
+ ExtraOpts.push_back("--hash-style=gnu");
}
#ifdef ENABLE_LINKER_BUILD_ID
More information about the cfe-commits
mailing list