Fix riscv64 and x86_64_v2 builds of gcc-toolset-16-gcc, and stop the v2
build from configuring the compiler for x86-64-v3.
--with-arch_64 is guarded by %ifarch x86_64 in the spec, and AlmaLinux's
rpm treats x86_64_v2 as matching x86_64, so the v2 toolset would otherwise
default to generating x86-64-v3 code. Same rule as gcc-toolset-15-gcc. No
bugurl rule is needed here: this spec already uses
--with-bugurl=%dist_bug_report_url, which expands to bugs.almalinux.org.
The other two failures are in the libstdc++ "nonshared" compat sources that
Patch1000 (gcc16-libstdc++-compat.patch) creates, so neither has an
upstream fix -- Red Hat builds neither arch.
riscv64: nonshared98/extfloat.S has no __riscv branch in its arch chain and
no #else fallback, so ALIGN1 reaches gas as a bare token:
extfloat.S:279: Error: unrecognized opcode `align1'
riscv64 was also missing from the 64-bit POINTER/SIZE group, which would
have emitted a 32-bit typeinfo layout on LP64. Patch taken as is from
autopatch/gcc-toolset-15-gcc, where it is already in use.
x86_64_v2: nonshared20/format-inst.cc hardcodes .hidden for
basic_string<wchar_t>::__resize_and_overwrite<lambda in
__format::__formatter_fp<wchar_t>::_M_localize>. That list was derived at
the el10 baseline -march=x86-64-v3; at v2 the compiler inlines the
instantiation away and emits nothing, so the bare .hidden directive leaves
an undefined hidden symbol in libstdc++_nonshared140.a and the compat test
link at the end of %build fails with
hidden symbol `_ZNSt7__cxx1112basic_string...' isn't defined
final link failed: bad value
This is driven by %optflags, not by --with-arch_64, so it needs its own
fix. Emission tracks the AVX2 boundary exactly (v1/v2 emit nothing, v3/v4
emit a 670-byte FUNC WEAK HIDDEN), so guard that one directive on __AVX2__.
This is a no-op at v3 -- the symbol table is unchanged -- and it removes the
dangling reference at v2. All 41 nonshared sources carrying .hidden were
checked at both ISA levels; this is the only symbol that differs.
30 lines
1.0 KiB
Diff
30 lines
1.0 KiB
Diff
From 8afa08292030c4da33ebf80ce39353678d9d9955 Mon Sep 17 00:00:00 2001
|
|
From: Andrew Lukoshko <alukoshko@almalinux.org>
|
|
Date: Wed, 18 Feb 2026 14:37:39 +0000
|
|
Subject: [PATCH] libstdc++-v3: add __riscv constants to extfloat.S
|
|
|
|
---
|
|
libstdc++-v3/src/nonshared98/extfloat.S | 5 ++++-
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/libstdc++-v3/src/nonshared98/extfloat.S b/libstdc++-v3/src/nonshared98/extfloat.S
|
|
index c72980884..9fad014c4 100644
|
|
--- a/libstdc++-v3/src/nonshared98/extfloat.S
|
|
+++ b/libstdc++-v3/src/nonshared98/extfloat.S
|
|
@@ -53,8 +53,11 @@
|
|
#elif defined __s390__
|
|
#define ALIGN1 .align 4
|
|
#define ALIGN3 .align 2
|
|
+#elif defined __riscv
|
|
+#define ALIGN1 .align 3
|
|
+#define ALIGN3 .align 3
|
|
#endif
|
|
-#if defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __ia64__ || defined __aarch64__
|
|
+#if defined __x86_64__ || defined __powerpc64__ || defined __s390x__ || defined __ia64__ || defined __aarch64__ || defined __riscv
|
|
#define SIZE1 32
|
|
#define SIZE2 16
|
|
#define OFF 16
|
|
--
|
|
2.43.7
|
|
|