From e0532f7f58df3ccf2dd7f8929037b34d7371131a Mon Sep 17 00:00:00 2001 From: Eduard Abdullin Date: Mon, 31 Aug 2026 19:10:47 +0000 Subject: [PATCH] Fix compilation on RISC-V Use 32-bit manglings in the libstdc++ nonshared .hidden list (fixes i686) Do not assert .hidden on _M_release_last_use_cold, which is not emitted on riscv64 nor on i686 Do not assert .hidden on a libstdc++ instantiation that is not emitted below x86-64-v3 (fixes x86_64_v2) Do not assert .hidden on _Sp_counted_ptr::_M_dispose, which is not emitted on riscv64 Do not assert .hidden on _Sp_counted_base<_S_atomic>::_M_destroy, which is not emitted on riscv64 Do not assert .hidden on __to_chars_10_impl, which is not emitted on riscv64 Do not assert .hidden on __get_leap_second_info, which is not emitted on i686 Refresh the ILP32 _M_visit manglings RH did not regenerate for 16.2.1 (fixes i686) Set --with-arch_64=x86-64-v2 on v2 arch --- gcc-toolset-16-gcc.spec | 6 ++++-- gcc16-nonshared-hidden.patch | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc-toolset-16-gcc.spec b/gcc-toolset-16-gcc.spec index c90dc02..04c42b7 100644 --- a/gcc-toolset-16-gcc.spec +++ b/gcc-toolset-16-gcc.spec @@ -186,7 +186,7 @@ BuildRequires: gcc-toolset-%{gts_ver}-devel Summary: GCC version %{gcc_major} Name: %{?scl_prefix}gcc Version: %{gcc_version} -Release: %{gcc_release}%{?dist}.alma.4 +Release: %{gcc_release}%{?dist}.alma.5 # License notes for some of the less obvious ones: # gcc/doc/cppinternals.texi: Linux-man-pages-copyleft-2-para # isl: MIT, BSD-2-Clause @@ -3097,7 +3097,7 @@ fi %endif %changelog -* Mon Aug 31 2026 Eduard Abdullin - 16.2.1-1.alma.4 +* Mon Aug 31 2026 Eduard Abdullin - 16.2.1-1.alma.5 - Fix compilation on RISC-V - Use 32-bit manglings in the libstdc++ nonshared .hidden list (fixes i686) - Do not assert .hidden on _M_release_last_use_cold, which is not emitted on @@ -3111,6 +3111,8 @@ fi - Do not assert .hidden on __to_chars_10_impl, which is not emitted on riscv64 - Do not assert .hidden on __get_leap_second_info, which is not emitted on i686 +- Refresh the ILP32 _M_visit manglings RH did not regenerate for 16.2.1 (fixes + i686) - Set --with-arch_64=x86-64-v2 on v2 arch * Mon Aug 10 2026 Marek Polacek 16.2.1-1 diff --git a/gcc16-nonshared-hidden.patch b/gcc16-nonshared-hidden.patch index 6860062..d1e6e76 100644 --- a/gcc16-nonshared-hidden.patch +++ b/gcc16-nonshared-hidden.patch @@ -59,6 +59,20 @@ asm (".hidden _ZNKSt8__format5_SinkIwE13_M_discardingEv"); asm (".hidden _ZNKSt8__format5_SinkIcE13_M_discardingEv"); asm (".hidden _ZNKSt8__format13_Padding_sinkINS_10_Sink_iterIcEEcE13_M_discardingEv"); +@@ -178,8 +210,11 @@ + asm (".hidden _ZNKSt8__format15__formatter_intIwE13_M_format_intINS_10_Sink_iterIwEEEENSt20basic_format_contextIT_wE8iteratorESt17basic_string_viewIwSt11char_traitsIwEEjRS7_"); + asm (".hidden _ZNSt8__format22__write_padded_as_specIwNS_10_Sink_iterIwEEEET0_St17basic_string_viewINSt13type_identityIT_E4typeESt11char_traitsIS8_EEjRSt20basic_format_contextIS3_S6_ERKNS_5_SpecIS6_EENS_6_AlignE"); + asm (".hidden _ZNSt8__format10__truncateIcEEjRSt17basic_string_viewIT_St11char_traitsIS2_EEj"); +-asm (".hidden _ZNSt16basic_format_argISt20basic_format_contextINSt8__format10_Sink_iterIwEEwEE8_M_visitIZNS1_19_Formatting_scannerIS3_wE13_M_format_argEjEUlRT_E_EEDcOS9_NS1_6_Arg_tE"); +-asm (".hidden _ZNSt16basic_format_argISt20basic_format_contextINSt8__format10_Sink_iterIcEEcEE8_M_visitIZNS1_19_Formatting_scannerIS3_cE13_M_format_argEjEUlRT_E_EEDcOS9_NS1_6_Arg_tE"); ++/* RH dropped the trailing __format::_Arg_t parameter from this lambda on ++ the LP64 side in 16.2.1 but never regenerated the ILP32 branch, so ++ mirror the change here -- otherwise both manglings are stale on i686. */ ++asm (".hidden _ZNSt16basic_format_argISt20basic_format_contextINSt8__format10_Sink_iterIwEEwEE8_M_visitIZNS1_19_Formatting_scannerIS3_wE13_M_format_argEjEUlRT_E_EEDcOS9_"); ++asm (".hidden _ZNSt16basic_format_argISt20basic_format_contextINSt8__format10_Sink_iterIcEEcEE8_M_visitIZNS1_19_Formatting_scannerIS3_cE13_M_format_argEjEUlRT_E_EEDcOS9_"); + asm (".hidden _ZNSt8__format13_Padding_sinkINS_10_Sink_iterIcEEcE10_M_reserveEj"); + asm (".hidden _ZNSt8__format13_Padding_sinkINS_10_Sink_iterIcEEcE7_M_bumpEj"); + asm (".hidden _ZNSt8__format13_Padding_sinkINS_10_Sink_iterIwEEwE10_M_reserveEj"); --- a/libstdc++-v3/src/nonshared20/clock.cc +++ b/libstdc++-v3/src/nonshared20/clock.cc @@ -33,7 +33,11 @@