[PATCH 4/5] nptl: Only issues __libc_unwind_link_get for SHARED

Collin Funk collin.funk1@gmail.com
Thu Feb 12 06:27:46 GMT 2026


Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:

> The compiler already optimizes it away for static builds.
> ---
>  nptl/pthread_exit.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/nptl/pthread_exit.c b/nptl/pthread_exit.c
> index 4d320e608f..4c15171992 100644
> --- a/nptl/pthread_exit.c
> +++ b/nptl/pthread_exit.c
> @@ -24,12 +24,14 @@
>  void
>  __pthread_exit (void *value)
>  {
> +#ifdef SHARED
>    {
>      struct unwind_link *unwind_link = __libc_unwind_link_get ();
>      if (unwind_link == NULL)
>        __libc_fatal (LIBGCC_S_SO
>                      " must be installed for pthread_exit to work\n");
>    }
> +#endif
>  
>    __do_cancel (value);
>  }

Maybe s/issues/call/ for the commit message? I think it makes it a bit
more clear.

But the change itself seems fine. It is optimized out in by builds as
well, since __libc_unwind_link_get () will just return 1 and never be
NULL.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>

Collin


More information about the Libc-alpha mailing list