[clang] b9e22cc - [Flang][driver] Do not emit -latomic on link line on Windows (#164648)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 10 08:10:36 PST 2025
Author: Michael Klemm
Date: 2025-11-10T17:10:32+01:00
New Revision: b9e22ccd95094ebf87e916d4e5bf8992204e927e
URL: https://github.com/llvm/llvm-project/commit/b9e22ccd95094ebf87e916d4e5bf8992204e927e
DIFF: https://github.com/llvm/llvm-project/commit/b9e22ccd95094ebf87e916d4e5bf8992204e927e.diff
LOG: [Flang][driver] Do not emit -latomic on link line on Windows (#164648)
Flang on Windows added `-latomic` to the link line. This library does
not exist on Windows and the linker gives a warning.
Added:
Modified:
clang/lib/Driver/ToolChain.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index eea5c2f7f4a6a..7f70f1c444eb9 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -851,8 +851,11 @@ void ToolChain::addFortranRuntimeLibs(const ArgList &Args,
options::OPT_fno_openmp, false)) {
Driver::OpenMPRuntimeKind OMPRuntime = getDriver().getOpenMPRuntime(Args);
ToolChain::RuntimeLibType RuntimeLib = GetRuntimeLibType(Args);
- if (OMPRuntime == Driver::OMPRT_OMP && RuntimeLib == ToolChain::RLT_Libgcc)
+ if ((OMPRuntime == Driver::OMPRT_OMP &&
+ RuntimeLib == ToolChain::RLT_Libgcc) &&
+ !getTriple().isKnownWindowsMSVCEnvironment()) {
CmdArgs.push_back("-latomic");
+ }
}
}
More information about the cfe-commits
mailing list