From 3f6db4064d2dea58d1d3b6556266b3f0e4b663fa Mon Sep 17 00:00:00 2001 From: Eduard Abdullin Date: Fri, 4 Sep 2026 06:16:25 +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 the _Sp_counted_base typeinfo name, 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 147beca..96a9fce 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}.1%{?dist}.alma.1 +Release: %{gcc_release}.1%{?dist}.alma.2 # License notes for some of the less obvious ones: # gcc/doc/cppinternals.texi: Linux-man-pages-copyleft-2-para # isl: MIT, BSD-2-Clause @@ -3090,7 +3090,7 @@ fi %endif %changelog -* Fri Sep 04 2026 Eduard Abdullin - 16.2.1-1.1.alma.1 +* Fri Sep 04 2026 Eduard Abdullin - 16.2.1-1.1.alma.2 - 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 @@ -3103,6 +3103,8 @@ fi emitted on riscv64 - Do not assert .hidden on __to_chars_10_impl, which is not emitted on riscv64 +- Do not assert .hidden on the _Sp_counted_base typeinfo name, 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) diff --git a/gcc16-nonshared-hidden.patch b/gcc16-nonshared-hidden.patch index d1e6e76..65c7fee 100644 --- a/gcc16-nonshared-hidden.patch +++ b/gcc16-nonshared-hidden.patch @@ -123,3 +123,17 @@ asm (".hidden _ZNSt6chrono11locate_zoneESt17basic_string_viewIcSt11char_traitsIcEE"); asm (".hidden _ZNSt6chrono11reload_tzdbEv"); asm (".hidden _ZNSt6chrono12current_zoneEv"); +@@ -57,7 +74,13 @@ + asm (".hidden _ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE"); + asm (".hidden _ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE"); + asm (".hidden _ZTSSt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE"); ++/* Not emitted on riscv64: gcc emits no vtable for _Sp_counted_base in this ++ TU -- cf. _M_dispose and _M_destroy above -- and the typeinfo name is ++ emitted with the vtable, so the bare .hidden would leave an undefined ++ hidden symbol in libstdc++_nonshared140.a. */ ++#if !defined(__riscv) + asm (".hidden _ZTSSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE"); ++#endif + asm (".hidden _ZTSSt19_Sp_make_shared_tag"); + asm (".hidden _ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag"); + asm (".hidden _ZGVNSt8__format11_ChronoDataIcE7_S_argsE");