[PATCH] D130569: [Driver] Use libatomic for 32-bit SPARC atomics support on Linux
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 26 12:51:59 PDT 2022
MaskRay added inline comments.
================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:634
+ // LLVM support for atomics on 32-bit SPARC V8+ is incomplete, so
+ // forcibly link with libatomic as a workaround.
----------------
`// TODO ...` and attach a bug link
================
Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:637
+ if (getToolChain().getTriple().getArch() == llvm::Triple::sparc) {
+ CmdArgs.push_back("--as-needed");
+ CmdArgs.push_back("-latomic");
----------------
Such --as-needed usage is a bit fragile if clang driver in the future passes `--as-needed` in the beginning. Better to use --push-state if you have a not-too-old ld.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130569/new/
https://reviews.llvm.org/D130569
More information about the cfe-commits
mailing list