0020-clang-implicitly-link-to-libatomic-on-linux-targets.patch (1415B)
1 From fafc3e8c4ab398e17911563f25b3fa8415cca69e Mon Sep 17 00:00:00 2001 2 From: q66 <q66@chimera-linux.org> 3 Date: Sat, 4 Nov 2023 09:12:24 +0100 4 Subject: [PATCH 20/29] clang: implicitly link to libatomic on linux targets 5 6 --- 7 clang/lib/Driver/ToolChains/Gnu.cpp | 10 ++++++---- 8 1 file changed, 6 insertions(+), 4 deletions(-) 9 10 diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp 11 index 5230be404..8180d98c7 100644 12 --- a/clang/lib/Driver/ToolChains/Gnu.cpp 13 +++ b/clang/lib/Driver/ToolChains/Gnu.cpp 14 @@ -613,10 +613,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, 15 16 AddRunTimeLibs(ToolChain, D, CmdArgs, Args); 17 18 - // LLVM support for atomics on 32-bit SPARC V8+ is incomplete, so 19 - // forcibly link with libatomic as a workaround. 20 - // TODO: Issue #41880 and D118021. 21 - if (getToolChain().getTriple().getArch() == llvm::Triple::sparc) { 22 + // implicitly link to libatomic, we don't want to bother with manually 23 + // adding this on platforms where libatomic is explicitly necessary, 24 + // and the as-needed will ensure it's left out when not needed 25 + // 26 + // chimera already ships its own version of libatomic, so it's fine 27 + if (Triple.isOSLinux()) { 28 CmdArgs.push_back("--push-state"); 29 CmdArgs.push_back("--as-needed"); 30 CmdArgs.push_back("-latomic"); 31 -- 32 2.49.0 33