Skip to content

Commit 483db58

Browse files
brooksdaviststellar
authored andcommitted
compiler-rt: Allow build without __c11_atomic_fetch_nand
Don't build atomic fetch nand libcall functions when the required compiler builtin isn't available. Without this compiler-rt can't be built with LLVM 13 or earlier. Not building the libcall functions isn't optimal, but aligns with the usecase in FreeBSD where compiler-rt from LLVM 14 is built with an LLVM 13 clang and no LLVM 14 clang is built. Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D126710 (cherry picked from commit 18efa42)
1 parent 576e5b3 commit 483db58

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler-rt/lib/builtins/atomic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ OPTIMISED_CASES
363363
#define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW(n, lockfree, type, xor, ^)
364364
OPTIMISED_CASES
365365
#undef OPTIMISED_CASE
366+
// Allow build with clang without __c11_atomic_fetch_nand builtin (pre-14)
367+
#if __has_builtin(__c11_atomic_fetch_nand)
366368
#define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW_NAND(n, lockfree, type)
367369
OPTIMISED_CASES
368370
#undef OPTIMISED_CASE
371+
#endif

0 commit comments

Comments
 (0)