Skip to content

Commit 18efa42

Browse files
brooksdavisemaste
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
1 parent e5ece11 commit 18efa42

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
@@ -365,6 +365,9 @@ OPTIMISED_CASES
365365
#define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW(n, lockfree, type, xor, ^)
366366
OPTIMISED_CASES
367367
#undef OPTIMISED_CASE
368+
// Allow build with clang without __c11_atomic_fetch_nand builtin (pre-14)
369+
#if __has_builtin(__c11_atomic_fetch_nand)
368370
#define OPTIMISED_CASE(n, lockfree, type) ATOMIC_RMW_NAND(n, lockfree, type)
369371
OPTIMISED_CASES
370372
#undef OPTIMISED_CASE
373+
#endif

0 commit comments

Comments
 (0)