[clang] [Flang][driver] Do not emit -latomic on link line on Windows (PR #164648)

Michael Kruse via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 23 06:34:08 PDT 2025


Meinersbur wrote:

I do have `libatomic.a` in my MinGW installation. The patch should only apply to MSVC build enviroment (cl.exe and link.exe). The command line switch wouldn't be `-l` anyway. The summary mentioned it was only a warning anyway.

Since LLVM may emit libgcc-style atomic calls, the only things that could provide them would be clang_rt.builtins.lib. These are disabled by default, `COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN=On`:
https://github.com/llvm/llvm-project/blob/ece83ed7dfe6ef65ac100efcc61f50a2a337436a/compiler-rt/lib/builtins/CMakeLists.txt#L232-L234

There also is an option to create an equivalent to libatomic: `clang_rt.atomic.lib` (`COMPILER_RT_BUILD_STANDALONE_LIBATOMIC`), even on Windows (I think).


https://github.com/llvm/llvm-project/pull/164648


More information about the cfe-commits mailing list