s390: Fix ABI issue in libstdc++.so.6

Message ID aWKUxdpzciax8Xt5@tucnak
State Committed
Headers
Series s390: Fix ABI issue in libstdc++.so.6 |

Checks

Context Check Description
rivoscibot/toolchain-ci-rivos-lint success Lint passed
rivoscibot/toolchain-ci-rivos-apply-patch fail Patch failed to apply

Commit Message

Jakub Jelinek Jan. 10, 2026, 6:04 p.m. UTC
  On Sat, Jan 10, 2026 at 05:24:15PM +0100, Stefan Schulze Frielinghaus wrote:
> libstdc++-v3/ChangeLog:
> 
> 	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Add
> 	names {,P,K}DF16.

This is wrong - an ABI issue.

You can't export new symbols in CXXABI_1.3.14 symbol version when they
weren't exported there in GCC 13.1 already.
Symbols new in GCC 16 like these should be exported in CXXABI_1.3.17.

So, I think you want (completely untested):

2026-01-10  Jakub Jelinek  <jakub@redhat.com>

	* config/abi/pre/gnu.ver (CXXABI_1.3.14): Don't export _ZTI*DF16_ on
	s390x.
	(CXXABI_1.3.17): Export _ZTI*DF16_ on s390x.
	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Remove
	_ZTI{,P,K}DF16_.



	Jakub
  

Comments

Stefan Schulze Frielinghaus Jan. 10, 2026, 6:40 p.m. UTC | #1
On Sat, Jan 10, 2026 at 07:04:53PM +0100, Jakub Jelinek wrote:
> On Sat, Jan 10, 2026 at 05:24:15PM +0100, Stefan Schulze Frielinghaus wrote:
> > libstdc++-v3/ChangeLog:
> > 
> > 	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Add
> > 	names {,P,K}DF16.
> 
> This is wrong - an ABI issue.
> 
> You can't export new symbols in CXXABI_1.3.14 symbol version when they
> weren't exported there in GCC 13.1 already.
> Symbols new in GCC 16 like these should be exported in CXXABI_1.3.17.

Yikes, you are absolutely right.  It was also wrong in the first draft I
posted back in Nov.  Thank you very much for double checking and
catching this!  I will trigger a full test run of your patch and come
back to you.

Cheers,
Stefan

> So, I think you want (completely untested):
> 
> 2026-01-10  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* config/abi/pre/gnu.ver (CXXABI_1.3.14): Don't export _ZTI*DF16_ on
> 	s390x.
> 	(CXXABI_1.3.17): Export _ZTI*DF16_ on s390x.
> 	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Remove
> 	_ZTI{,P,K}DF16_.
> 
> --- libstdc++-v3/config/abi/pre/gnu.ver.jj	2026-01-02 09:56:10.583329488 +0100
> +++ libstdc++-v3/config/abi/pre/gnu.ver	2026-01-10 18:58:37.133669626 +0100
> @@ -2899,9 +2899,16 @@ CXXABI_1.3.14 {
>  
>      # typeinfo for _Float{16,32,64,128,32x,64x,128x} and
>      # __bf16/bfloat16_t
> +#ifndef __s390x__
>      _ZTIDF[0-9]*[_x];
>      _ZTIPDF[0-9]*[_x];
>      _ZTIPKDF[0-9]*[_x];
> +#else
> +    # No _Float16 on s390x in GCC 13.
> +    _ZTIDF[0-9]*[0-57-9][_x];
> +    _ZTIPDF[0-9]*[0-57-9][_x];
> +    _ZTIPKDF[0-9]*[0-57-9][_x];
> +#endif
>  #ifndef __riscv
>      _ZTIDF16b;
>      _ZTIPDF16b;
> @@ -2933,6 +2940,13 @@ CXXABI_1.3.16 {
>  CXXABI_1.3.17 {
>      # std::exception_ptr::_M_exception_ptr_cast
>      _ZNKSt15__exception_ptr13exception_ptr21_M_exception_ptr_castERKSt9type_info;
> +
> +#ifdef __s390x__
> +    _ZTIDF16_;
> +    _ZTIPDF16_;
> +    _ZTIPKDF16_;
> +#endif
> +
>  #ifdef __riscv
>  } CXXABI_1.3.16;
>  #else
> --- libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt.jj	2026-01-10 18:52:48.533640534 +0100
> +++ libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt	2026-01-10 18:59:02.224239870 +0100
> @@ -4951,7 +4951,6 @@ OBJECT:15:_ZTSSt8messagesIwE@@GLIBCXX_3.
>  OBJECT:15:_ZTSSt8numpunctIcE@@GLIBCXX_3.4
>  OBJECT:15:_ZTSSt8numpunctIwE@@GLIBCXX_3.4
>  OBJECT:16:_ZTIDF128_@@CXXABI_1.3.14
> -OBJECT:16:_ZTIDF16_@@CXXABI_1.3.14
>  OBJECT:16:_ZTIDF32_@@CXXABI_1.3.14
>  OBJECT:16:_ZTIDF32x@@CXXABI_1.3.14
>  OBJECT:16:_ZTIDF64_@@CXXABI_1.3.14
> @@ -5616,7 +5615,6 @@ OBJECT:30:_ZTSSt7codecvtIDsDu11__mbstate
>  OBJECT:32:_ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4
>  OBJECT:32:_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4
>  OBJECT:32:_ZTIPDF128_@@CXXABI_1.3.14
> -OBJECT:32:_ZTIPDF16_@@CXXABI_1.3.14
>  OBJECT:32:_ZTIPDF32_@@CXXABI_1.3.14
>  OBJECT:32:_ZTIPDF32x@@CXXABI_1.3.14
>  OBJECT:32:_ZTIPDF64_@@CXXABI_1.3.14
> @@ -5629,7 +5627,6 @@ OBJECT:32:_ZTIPDn@@CXXABI_1.3.5
>  OBJECT:32:_ZTIPDs@@CXXABI_1.3.3
>  OBJECT:32:_ZTIPDu@@CXXABI_1.3.12
>  OBJECT:32:_ZTIPKDF128_@@CXXABI_1.3.14
> -OBJECT:32:_ZTIPKDF16_@@CXXABI_1.3.14
>  OBJECT:32:_ZTIPKDF32_@@CXXABI_1.3.14
>  OBJECT:32:_ZTIPKDF32x@@CXXABI_1.3.14
>  OBJECT:32:_ZTIPKDF64_@@CXXABI_1.3.14
> 
> 
> 	Jakub
>
  
Stefan Schulze Frielinghaus Jan. 11, 2026, 6:06 p.m. UTC | #2
On Sat, Jan 10, 2026 at 07:40:37PM +0100, Stefan Schulze Frielinghaus wrote:
> On Sat, Jan 10, 2026 at 07:04:53PM +0100, Jakub Jelinek wrote:
> > On Sat, Jan 10, 2026 at 05:24:15PM +0100, Stefan Schulze Frielinghaus wrote:
> > > libstdc++-v3/ChangeLog:
> > > 
> > > 	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Add
> > > 	names {,P,K}DF16.
> > 
> > This is wrong - an ABI issue.
> > 
> > You can't export new symbols in CXXABI_1.3.14 symbol version when they
> > weren't exported there in GCC 13.1 already.
> > Symbols new in GCC 16 like these should be exported in CXXABI_1.3.17.
> 
> Yikes, you are absolutely right.  It was also wrong in the first draft I
> posted back in Nov.  Thank you very much for double checking and
> catching this!  I will trigger a full test run of your patch and come
> back to you.

Bootstrap and regtest are successful for targets z16, z14, z13, z10,
z900.

Thanks,
Stefan
  
Jakub Jelinek Jan. 12, 2026, 12:28 a.m. UTC | #3
On Sun, Jan 11, 2026 at 07:06:28PM +0100, Stefan Schulze Frielinghaus wrote:
> On Sat, Jan 10, 2026 at 07:40:37PM +0100, Stefan Schulze Frielinghaus wrote:
> > On Sat, Jan 10, 2026 at 07:04:53PM +0100, Jakub Jelinek wrote:
> > > On Sat, Jan 10, 2026 at 05:24:15PM +0100, Stefan Schulze Frielinghaus wrote:
> > > > libstdc++-v3/ChangeLog:
> > > > 
> > > > 	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Add
> > > > 	names {,P,K}DF16.
> > > 
> > > This is wrong - an ABI issue.

BTW, if you didn't adjust the baseline_symbols.txt, the testsuite error
would tell you something wrong happened.
Guess I should verify the _Float*/__bf16 rtti symbols in all
baseline_symbols.txt from 13 to latest trunk to make sure other targets
haven't done the same thing.

> > > You can't export new symbols in CXXABI_1.3.14 symbol version when they
> > > weren't exported there in GCC 13.1 already.
> > > Symbols new in GCC 16 like these should be exported in CXXABI_1.3.17.
> > 
> > Yikes, you are absolutely right.  It was also wrong in the first draft I
> > posted back in Nov.  Thank you very much for double checking and
> > catching this!  I will trigger a full test run of your patch and come
> > back to you.
> 
> Bootstrap and regtest are successful for targets z16, z14, z13, z10,
> z900.

I've also bootstrapped/regtested it successfully on x86_64-linux and
i686-linux, plus verified the abilist before/after.

Though, I'm not sure if the patch falls under target maintainership, while
the code actually doesn't affect other targets, if it was buggy it would.

So I think we need Jonathan's ack.

	Jakub
  
Jonathan Wakely Jan. 12, 2026, 11:35 a.m. UTC | #4
On Sun, 11 Jan 2026 at 18:08, Stefan Schulze Frielinghaus
<stefansf@linux.ibm.com> wrote:
>
> On Sat, Jan 10, 2026 at 07:40:37PM +0100, Stefan Schulze Frielinghaus wrote:
> > On Sat, Jan 10, 2026 at 07:04:53PM +0100, Jakub Jelinek wrote:
> > > On Sat, Jan 10, 2026 at 05:24:15PM +0100, Stefan Schulze Frielinghaus wrote:
> > > > libstdc++-v3/ChangeLog:
> > > >
> > > >   * config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Add
> > > >   names {,P,K}DF16.
> > >
> > > This is wrong - an ABI issue.
> > >
> > > You can't export new symbols in CXXABI_1.3.14 symbol version when they
> > > weren't exported there in GCC 13.1 already.
> > > Symbols new in GCC 16 like these should be exported in CXXABI_1.3.17.
> >
> > Yikes, you are absolutely right.  It was also wrong in the first draft I
> > posted back in Nov.  Thank you very much for double checking and
> > catching this!  I will trigger a full test run of your patch and come
> > back to you.
>
> Bootstrap and regtest are successful for targets z16, z14, z13, z10,
> z900.

The patch is OK then, thanks
  

Patch

--- libstdc++-v3/config/abi/pre/gnu.ver.jj	2026-01-02 09:56:10.583329488 +0100
+++ libstdc++-v3/config/abi/pre/gnu.ver	2026-01-10 18:58:37.133669626 +0100
@@ -2899,9 +2899,16 @@  CXXABI_1.3.14 {
 
     # typeinfo for _Float{16,32,64,128,32x,64x,128x} and
     # __bf16/bfloat16_t
+#ifndef __s390x__
     _ZTIDF[0-9]*[_x];
     _ZTIPDF[0-9]*[_x];
     _ZTIPKDF[0-9]*[_x];
+#else
+    # No _Float16 on s390x in GCC 13.
+    _ZTIDF[0-9]*[0-57-9][_x];
+    _ZTIPDF[0-9]*[0-57-9][_x];
+    _ZTIPKDF[0-9]*[0-57-9][_x];
+#endif
 #ifndef __riscv
     _ZTIDF16b;
     _ZTIPDF16b;
@@ -2933,6 +2940,13 @@  CXXABI_1.3.16 {
 CXXABI_1.3.17 {
     # std::exception_ptr::_M_exception_ptr_cast
     _ZNKSt15__exception_ptr13exception_ptr21_M_exception_ptr_castERKSt9type_info;
+
+#ifdef __s390x__
+    _ZTIDF16_;
+    _ZTIPDF16_;
+    _ZTIPKDF16_;
+#endif
+
 #ifdef __riscv
 } CXXABI_1.3.16;
 #else
--- libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt.jj	2026-01-10 18:52:48.533640534 +0100
+++ libstdc++-v3/config/abi/post/s390x-linux-gnu/baseline_symbols.txt	2026-01-10 18:59:02.224239870 +0100
@@ -4951,7 +4951,6 @@  OBJECT:15:_ZTSSt8messagesIwE@@GLIBCXX_3.
 OBJECT:15:_ZTSSt8numpunctIcE@@GLIBCXX_3.4
 OBJECT:15:_ZTSSt8numpunctIwE@@GLIBCXX_3.4
 OBJECT:16:_ZTIDF128_@@CXXABI_1.3.14
-OBJECT:16:_ZTIDF16_@@CXXABI_1.3.14
 OBJECT:16:_ZTIDF32_@@CXXABI_1.3.14
 OBJECT:16:_ZTIDF32x@@CXXABI_1.3.14
 OBJECT:16:_ZTIDF64_@@CXXABI_1.3.14
@@ -5616,7 +5615,6 @@  OBJECT:30:_ZTSSt7codecvtIDsDu11__mbstate
 OBJECT:32:_ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4
 OBJECT:32:_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4
 OBJECT:32:_ZTIPDF128_@@CXXABI_1.3.14
-OBJECT:32:_ZTIPDF16_@@CXXABI_1.3.14
 OBJECT:32:_ZTIPDF32_@@CXXABI_1.3.14
 OBJECT:32:_ZTIPDF32x@@CXXABI_1.3.14
 OBJECT:32:_ZTIPDF64_@@CXXABI_1.3.14
@@ -5629,7 +5627,6 @@  OBJECT:32:_ZTIPDn@@CXXABI_1.3.5
 OBJECT:32:_ZTIPDs@@CXXABI_1.3.3
 OBJECT:32:_ZTIPDu@@CXXABI_1.3.12
 OBJECT:32:_ZTIPKDF128_@@CXXABI_1.3.14
-OBJECT:32:_ZTIPKDF16_@@CXXABI_1.3.14
 OBJECT:32:_ZTIPKDF32_@@CXXABI_1.3.14
 OBJECT:32:_ZTIPKDF32x@@CXXABI_1.3.14
 OBJECT:32:_ZTIPKDF64_@@CXXABI_1.3.14