[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
Fri Oct 24 06:30:19 PDT 2025


Meinersbur wrote:

> I haven't done anything special to turn on atomic support in compiler-rt and I can build and run at least simple programs using omp atomic and get the expected results. Not sure where I'm getting the symbols from.

LLVM emits CPU instructions for supported cases. A call to a runtime function (should[^1]) only happens as a fallback, e.g. when the number of bytes that needs to be atomically written is not a constant 1, 2, 4, or 8. msvc does not support `int128_t`, so the case of `integer(16)` (or `complex(8)`) falls outside what Microsoft's msvc/ucrt could handle, at least before its [C11 atomics support](https://devblogs.microsoft.com/cppblog/c11-atomics-in-visual-studio-2022-version-17-5-preview-2/) which implements its own builtins such as `__atomic_store_n`. LLVM just needs to know about them.

[^1]: Currently Flang determines this on the data type, not by byte length. So you may see atomic calls even when not strictly necessary. #134455 was meant to fix this.

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


More information about the cfe-commits mailing list