From 14b2649bad3011a45aa4a73894ba7ebe56cd5e90 Mon Sep 17 00:00:00 2001 From: Christopher Wellons Date: Fri, 14 Aug 2026 15:01:45 -0400 Subject: [PATCH] Fix the i686 build of the single-ABI libstdc++ The Transactional Memory TS clones in cow-stdexcept.cc are written against COW string internals (_Rep, _M_dataplus) and so can only be compiled when std::basic_string is the COW string. This was invisible on x86_64, where _GLIBCXX_USE_WEAK_REF is false and the section is skipped entirely, but broke the i686 build, where it is true. Compile the clones only when the string ABI matches. Their absence is legal by design: they are weakly referenced, and -fgnu-tm code falls back to serial-irrevocable execution. (-fgnu-tm with libstdc++ headers is broken in GCC 16.2 regardless, in both dual-ABI and single-ABI builds: new_allocator.h trips over __builtin_operator_new selection.) Co-Authored-By: Claude Fable 5 --- src/gcc-new-abi-only.patch | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/gcc-new-abi-only.patch b/src/gcc-new-abi-only.patch index b8a9262..bbf3c70 100644 --- a/src/gcc-new-abi-only.patch +++ b/src/gcc-new-abi-only.patch @@ -5,7 +5,7 @@ gcc4-compatible COW std::string. For a from-scratch toolchain the useful single-ABI configuration is the reverse: only the modern SSO string. The library supports either direction: c++config.h neutralizes the per-file ABI pins in single-ABI builds, and the Makefiles already -exclude the cow-*, cxx11-*, and shim facet objects. Three fixups +exclude the cow-*, cxx11-*, and shim facet objects. Four fixups beyond the configure default: ios_base::failure derives from exception in the old ABI but from @@ -21,6 +21,12 @@ time_put, ctype, codecvt, __pad) with !_GLIBCXX_USE_CXX11_ABI so the dual ABI instantiates them exactly once, in the old-ABI object. A new-ABI-only build must instantiate them in its only compile. +The Transactional Memory TS clones in cow-stdexcept.cc are written +against COW string internals (_Rep, public _M_dataplus), so they can +only be compiled when std::basic_string is the COW string. This is +invisible on x86_64, where _GLIBCXX_USE_WEAK_REF is false, but breaks +the i686 build. + --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -51668,7 +51668,7 @@ @@ -32,6 +38,17 @@ new-ABI-only build must instantiate them in its only compile. fi +--- a/libstdc++-v3/src/c++11/cow-stdexcept.cc ++++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc +@@ -198,7 +198,7 @@ + // are not defined by us. Without such support, the exceptions will not be + // declared transaction-safe, so we just don't provide transactional clones + // in this case. +-#if _GLIBCXX_USE_WEAK_REF ++#if _GLIBCXX_USE_WEAK_REF && ! _GLIBCXX_USE_CXX11_ABI + #ifdef _GLIBCXX_USE_C99_STDINT + + #include --- a/libstdc++-v3/src/c++11/ios_errcat.cc +++ b/libstdc++-v3/src/c++11/ios_errcat.cc @@ -28,6 +28,14 @@