From c6f48859d83d95777b52cb21184c9e68b34ef502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 5 Dec 2023 13:54:32 +0200 Subject: [PATCH] build-compiler-rt: Include atomics helpers in the builtins library These helpers are statically linked into each DLL/EXE that uses them. They are primarily used for atomic access to variables that are larger than what the platform natively can support - i.e. primarily for accessing atomic variables larger than 8 bytes. The fallback implementations rely on explicit locks (spinlocks in practice). As the locks are statically linked into each module that uses the atomic variable, any concurrent access to such an atomic variable from two different DLLs/EXEs wouldn't actually end up being properly atomic. However cross-module atomic variables (larger than 8 bytes) is very rare so this isn't deemed to be much of a practical issue. In GCC based toolchains, the corresponding helpers reside in a separate shared library, libatomic-1.dll (although it can also be linked statically). --- build-compiler-rt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build-compiler-rt.sh b/build-compiler-rt.sh index 04627e8..68ff1f8 100755 --- a/build-compiler-rt.sh +++ b/build-compiler-rt.sh @@ -113,6 +113,7 @@ for arch in $ARCHS; do -DCOMPILER_RT_DEFAULT_TARGET_ONLY=TRUE \ -DCOMPILER_RT_USE_BUILTINS_LIBRARY=TRUE \ -DCOMPILER_RT_BUILD_BUILTINS=$BUILD_BUILTINS \ + -DCOMPILER_RT_EXCLUDE_ATOMIC_BUILTIN=FALSE \ -DLLVM_CONFIG_PATH="" \ -DCMAKE_FIND_ROOT_PATH=$PREFIX/$arch-w64-mingw32 \ -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \