On Mon, Feb 17, 2025 at 6:19 PM Roman Kagan <rka...@amazon.de> wrote:
>
> On Thu, Jan 02, 2025 at 04:32:17PM +0100, Roman Kagan wrote:
> > When gcc is built for x86_64-linux-musl target, stack unwinding from
> > within signal handler stops at the innermost signal frame.  The reason
> > for this behaviro is that the signal trampoline is not accompanied with
> > appropiate CFI directives, and the fallback path in libgcc to recognize
> > it by the code sequence is only enabled for glibc except 2.0.  The
> > latter is motivated by the lack of sys/ucontext.h in that glibc version.
> >
> > Given that all relevant libc-s ship sys/ucontext.h for over a decade,
> > and that other arches aren't shy of unconditionally using it, follow
> > suit and remove the preprocessor condition, too.

"Relevant libc"-s for x86 linux are LIBC_GLIBC, LIBC_UCLIBC,
LIBC_BIONIC and LIBC_MUSL. As far as glibc is concerned, the latest
glibc 2.0.x version was released in 1997 [1], so I guess we can remove
the condition for version 2.0. Based on your claim, the other
mentioned libcs also provide the required header for a long time.

I have no objection to the patch, but I think that this patch is a bit
late for gcc-15 and should be committed early in the gcc-16
development cycle. But let's hear release managers (CC'd).

[1] https://sourceware.org/glibc/wiki/Glibc%20Timeline

Thanks,
Uros.

> >

> > Signed-off-by: Roman Kagan <rka...@amazon.de>
> > ---
> >  libgcc/config/i386/linux-unwind.h | 7 -------
> >  1 file changed, 7 deletions(-)
> >
> > diff --git a/libgcc/config/i386/linux-unwind.h 
> > b/libgcc/config/i386/linux-unwind.h
> > index fe316ee02cf2..8f37642bbf55 100644
> > --- a/libgcc/config/i386/linux-unwind.h
> > +++ b/libgcc/config/i386/linux-unwind.h
> > @@ -33,12 +33,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
> >  If not, see
> >
> >  #ifndef inhibit_libc
> >
> > -/* There's no sys/ucontext.h for glibc 2.0, so no
> > -   signal-turned-exceptions for them.  There's also no configure-run for
> > -   the target, so we can't check on (e.g.) HAVE_SYS_UCONTEXT_H.  Using the
> > -   target libc version macro should be enough.  */
> > -#if defined __GLIBC__ && !(__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
> > -
> >  #include <signal.h>
> >  #include <sys/ucontext.h>
> >
> > @@ -199,5 +193,4 @@ x86_frob_update_context (struct _Unwind_Context 
> > *context,
> >  }
> >
> >  #endif /* ifdef __x86_64__  */
> > -#endif /* not glibc 2.0 */
> >  #endif /* ifdef inhibit_libc  */
>
> Ping?
>
> Roman.

Reply via email to