On Thu, Sep 24, 2026 at 09:55:06AM +0200, Juergen Christ wrote:
> > On Wed, Sep 23, 2026 at 11:25:07AM +0200, Juergen Christ wrote:
> > > thanks for your work on this. I will implement the s390x specific
> > > part once this series is accepted.
> >
> > Great; thank you!
> >
> > > I looked at this on s390x. We actually change the mangling of long
> > > double if we are on a target where long double is 128bit IEEE to a
> > > "g". This causes this self-test to fail. I suggest to add this patch
> > > on top of our patch to fix this:
> > >
> > > diff --git a/gcc/kcfi-typeinfo.cc b/gcc/kcfi-typeinfo.cc
> > > index b6723fac48da..fab06249ae16 100644
> > > --- a/gcc/kcfi-typeinfo.cc
> > > +++ b/gcc/kcfi-typeinfo.cc
> > > @@ -659,7 +659,14 @@ test_typeinfo_basic_types ()
> > > ASSERT_STREQ ("y", kcfi_test_mangle
> > > (long_long_unsigned_type_node).c_str ());
> > > ASSERT_STREQ ("f", kcfi_test_mangle (float_type_node).c_str ());
> > > ASSERT_STREQ ("d", kcfi_test_mangle (double_type_node).c_str ());
> > > +#if defined (__s390x__)
> > > + if (TARGET_LONG_DOUBLE_128)
> > > + ASSERT_STREQ ("g", kcfi_test_mangle (long_double_type_node).c_str
> > > ());
> > > + else
> > > + ASSERT_STREQ ("e", kcfi_test_mangle (long_double_type_node).c_str
> > > ());
> > > +#else
> > > ASSERT_STREQ ("e", kcfi_test_mangle (long_double_type_node).c_str ());
> > > +#endif
> > > }
> > >
> > > /* Test mangling of pointer types. */
> >
> > So this portion is only needed once there is s390 support? I'm unclear
> > on patch ordering.
>
> No, with your original patch applied, gcc for s390x cannot be built in
> checking mode anymore since it fails this self-test.
Ah, thanks, I had misunderstood.
Following Andrea's and Jakub's suggestions, I've changed this for v17
to make the self-test expect whatever targetm.mangle_type() returns for
long double, falling back to "e". That avoids the host #ifdef and handles
every target with a special long double mangling. The mangler itself
already consults the hook, so only the test expectation was wrong. The
builtin-typeinfo.c run test assumed "Ce" for _Complex long double;
it now builds its expectation from the mangling of plain long double.
-Kees
--
Kees Cook