[PATCH 4/4] htl: move pthread_self into libc

Florian Weimer fw@deneb.enyo.de
Thu Jan 2 09:26:47 GMT 2025


* Samuel Thibault:

> Hello,
>
> Digging back an old thread (heh).
>
> Florian Weimer, le lun. 31 oct. 2022 08:24:59 +0100, a ecrit:
>> > diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
>> > index 26552958..bfa47282 100644
>> > --- a/sysdeps/mach/hurd/i386/libc.abilist
>> > +++ b/sysdeps/mach/hurd/i386/libc.abilist
>> > @@ -29,6 +29,7 @@ GLIBC_2.11 mkostemps64 F
>> >  GLIBC_2.11 mkstemps F
>> >  GLIBC_2.11 mkstemps64 F
>> >  GLIBC_2.12 pthread_equal F
>> > +GLIBC_2.12 pthread_self F
>> >  GLIBC_2.13 __fentry__ F
>> >  GLIBC_2.14 syncfs F
>> >  GLIBC_2.15 __fdelt_chk F
>> 
>> “GLIBC_2.37 pthread_self” needs to show up there, in addition to the
>> GLIBC_2.12 version.
>
> Why is this needed? Can we not just move the libpthread symbol in libc
> with the same version? In which case do we need to add a new version?

It's required so that newly linked binaries acquire a version
reference that indicates glibc contains this commit:

commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Jun 28 10:12:50 2019 +0200

    ld.so: Support moving versioned symbols between sonames [BZ #24741]
    
    This change should be fully backwards-compatible because the old
    code aborted the load if a soname mismatch was encountered
    (instead of searching further for a matching symbol).  This means
    that no different symbols are found.
    
    The soname check was explicitly disabled for the skip_map != NULL
    case.  However, this only happens with dl(v)sym and RTLD_NEXT,
    and those lookups do not come with a verneed entry that could be used
    for the check.
    
    The error check was already explicitly disabled for the skip_map !=
    NULL case, that is, when dl(v)sym was called with RTLD_NEXT.  But
    _dl_vsym always sets filename in the struct r_found_version argument
    to NULL, so the check was not active anyway.  This means that
    symbol lookup results for the skip_map != NULL case do not change,
    either.

This change went into glibc 2.30.  Main programs already end up with a
__libc_start_main@@GLIBC_2.34 reference, but shared objects do not.


More information about the Libc-alpha mailing list