diff --git a/libstdc++-v3/ChangeLog.omp b/libstdc++-v3/ChangeLog.omp index daca152e84a5..a704e56156fe 100644 --- a/libstdc++-v3/ChangeLog.omp +++ b/libstdc++-v3/ChangeLog.omp @@ -1,5 +1,15 @@ 2025-04-17 Thomas Schwinge + Backported from trunk: + 2025-04-07 Thomas Schwinge + + PR target/119645 + * acinclude.m4 (GLIBCXX_ENABLE_LOCK_POLICY) [GCN, nvptx]: + Hard-code results. + * configure: Regenerate. + * configure.host [GCN, nvptx] (atomicity_dir): Set to + 'cpu/generic/atomicity_builtins'. + Backported from trunk: 2025-04-03 Thomas Schwinge diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 1c6d725a1359..453e231c7ec1 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -4023,10 +4023,11 @@ 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 + #if defined __AMDGCN__ || defined __nvptx__ + /* Yes, please. */ + #elif defined __riscv # error "Defaulting to mutex-based locks for ABI compatibility" - #endif - #if ! defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 + #elif ! defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 # error "No 2-byte compare-and-swap" #elif ! defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 # error "No 4-byte compare-and-swap" diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 789c3929f4a5..377a788300c6 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -16394,10 +16394,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #if defined __riscv + #if defined __AMDGCN__ || defined __nvptx__ + /* Yes, please. */ + #elif defined __riscv # error "Defaulting to mutex-based locks for ABI compatibility" - #endif - #if ! defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 + #elif ! defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 # error "No 2-byte compare-and-swap" #elif ! defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 # error "No 4-byte compare-and-swap" @@ -16444,7 +16445,7 @@ $as_echo "mutex" >&6; } # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 16447 "configure" +#line 16448 "configure" int main() { _Decimal32 d1; @@ -16486,7 +16487,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 16489 "configure" +#line 16490 "configure" template struct same { typedef T2 type; }; diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host index 8375764bf4dc..253e5a9ad0db 100644 --- a/libstdc++-v3/configure.host +++ b/libstdc++-v3/configure.host @@ -370,10 +370,21 @@ case "${host}" in ;; esac ;; + amdgcn-*-amdhsa) + # To avoid greater pain elsewhere, force use of '__atomic' builtins, + # regardless of the outcome of 'configure' checks; see PR119645 + # "GCN, nvptx: libstdc++ 'checking for atomic builtins [...]... no'". + atomicity_dir=cpu/generic/atomicity_builtins + ;; arm*-*-freebsd*) port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver" ;; nvptx-*-none) + # To avoid greater pain elsewhere, force use of '__atomic' builtins, + # regardless of the outcome of 'configure' checks; see PR119645 + # "GCN, nvptx: libstdc++ 'checking for atomic builtins [...]... no'". + atomicity_dir=cpu/generic/atomicity_builtins + # For 'make all-target-libstdc++-v3', re 'alloca'/VLA usage: EXTRA_CFLAGS="${EXTRA_CFLAGS} -mfake-ptx-alloca" OPTIMIZE_CXXFLAGS="${OPTIMIZE_CXXFLAGS} -mfake-ptx-alloca"