aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/acinclude.m4
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@rivosinc.com>2022-04-14 17:22:58 +0100
committerJonathan Wakely <jwakely@redhat.com>2022-04-14 17:31:15 +0100
commit3fc22eedb033cbff1bf5a70c6a032d3c5ce2d867 (patch)
treeb13889f1043ceeb1463917dfb1d26446dbd46ec0 /libstdc++-v3/acinclude.m4
parent832fcbbc7311c706f81e85043b5721e5f16b0a16 (diff)
downloadgcc-3fc22eedb033cbff1bf5a70c6a032d3c5ce2d867.zip
gcc-3fc22eedb033cbff1bf5a70c6a032d3c5ce2d867.tar.gz
gcc-3fc22eedb033cbff1bf5a70c6a032d3c5ce2d867.tar.bz2
libstdc++: Default to mutex-based atomics on RISC-V
The RISC-V port requires libatomic to be linked in order to resolve various atomic functions, which results in builds that have "--with-libstdcxx-lock-policy=auto" defaulting to mutex-based locks. Changing this to direct atomics breaks the ABI, this forces the auto detection mutex-based atomics on RISC-V in order to avoid a silent ABI break for users. See Bug 84568 for more discussion. In the long run there may be a way to get the higher-performance atomics without an ABI flag day, but that's going to be a much more complicated operation. We don't even have support for the inline atomics yet, but given that some folks have been discussing hacks to make these libatomic routines appear implicitly it seems prudent to just turn off the automatic detection for RISC-V. libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_LOCK_POLICY): Force auto to mutex for RISC-V. * configure: Regenerate.
Diffstat (limited to 'libstdc++-v3/acinclude.m4')
-rw-r--r--libstdc++-v3/acinclude.m43
1 files changed, 3 insertions, 0 deletions
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index eac8aed..6aece2a 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3612,6 +3612,9 @@ AC_DEFUN([GLIBCXX_ENABLE_LOCK_POLICY], [
dnl Why don't we check 8-byte CAS for sparc64, where _Atomic_word is long?!
dnl New targets should only check for CAS for the _Atomic_word type.
AC_TRY_COMPILE([
+ #if defined __riscv
+ # error "Defaulting to mutex-based locks for ABI compatibility"
+ #endif
#if ! defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
# error "No 2-byte compare-and-swap"
#elif ! defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4