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