Skip to content

build: Don't add `-latomic` for clang

compiler-rt supports __atomic_is_lock_free since LLVM 12[0]. Requiring -latomic on clang builds introduces a dependency on libgcc, which is often undesirable on LLVM-based build environments. This change makes sure it's never added in clang builds, so it can use the compiler-rt's implementation, making it possible to build Node.js on Linux systems with LLVM as the main toolchain, without having to install GCC.

compiler-rt's __atomic_is_lock_free works on all architectures, so there is no need to to link libatomic for mips64, ppc, arm, riscv etc. as well, as long as clang is used.

Similar patch was already adopted or discussed in:

[0] https://github.com/llvm/llvm-project/commit/00530dee5d1295dc20ebafdd9a8a79662f41513e

Merge request reports

Loading