RFC: Add GNU_PROPERTY_1_GLIBC_2_NEEDED

H.J. Lu hjl.tools@gmail.com
Tue Oct 26 15:51:29 GMT 2021


On Tue, Oct 26, 2021 at 8:26 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> > [hjl@gnu-cfl-2 elfvers-1]$ make x
> > gcc -B./ -o x x.o glibc-2-minor-1.o
> > [hjl@gnu-cfl-2 elfvers-1]$ ./readelf -n --version-info x
> > Version symbols section '.gnu.version' contains 4 entries:
> >  Addr: 0x00000000004004ae  Offset: 0x0004ae  Link: 6 (.dynsym)
> >   000:   0 (*local*)       2 (GLIBC_2.34)    3 (GLIBC_2.2.5)   1 (*global*)
> >
> > Version needs section '.gnu.version_r' contains 1 entry:
> >  Addr: 0x00000000004004b8  Offset: 0x0004b8  Link: 7 (.dynstr)
> >   000000: Version: 1  File: libc.so.6  Cnt: 4
> >   0x0010:   Name: GLIBC_2.38  Flags: none  Version: 5
> >   0x0020:   Name: GLIBC_2.35  Flags: none  Version: 4
> >   0x0030:   Name: GLIBC_2.2.5  Flags: none  Version: 3
> >   0x0040:   Name: GLIBC_2.34  Flags: none  Version: 2
> >
> > Displaying notes found in: .note.gnu.property
> >   Owner                Data size        Description
> >   GNU                  0x00000040       NT_GNU_PROPERTY_TYPE_0
> >       Properties: 1_glibc_2_needed: 2.35, 2.38
> > ...
> > [hjl@gnu-cfl-2 elfvers-1]$ ./x
> > ./x: /lib64/libc.so.6: version `GLIBC_2.38' not found (required by ./x)
> > ./x: /lib64/libc.so.6: version `GLIBC_2.35' not found (required by ./x)
> > [hjl@gnu-cfl-2 elfvers-1]$
>
> What's the intended use case?

The intended use case is to add a glibc version dependency without
referencing any symbols for the glibc version.

> This proposal may conflict in spirit with the glibc proposal to support
> preloadable symbol version (so you can add _dl_find_eh_frame@GLIBC_2.35
> to a glibc 2.28 installation, for example).  So far, symbol versions

Why will adding a glibc version dependency change the preload behavior?

> have only been used as a quick check for ABI coverage that also works
> with lazy binding.  This doesn't look the right mechanism to me without
> also bringing in new marker symbols, in which case the note is not
> needed.

The  GNU_PROPERTY_1_GLIBC_2_NEEDED note can be removed
from shared libraries and executables.

>
> The problem that linkers and loaders ignore unknown types should be
> tackled in a different way, e.g. by flagging critical types in some way.
> See:
>
>   Critical program headers and dynamic tags
>   <https://groups.google.com/g/generic-abi/c/vdG_G4l3N-Y/m/SB3DurdbBAAJ>
>

This won't help the existing ld.so binaries which this proposal
is addressing.

-- 
H.J.


More information about the Libc-alpha mailing list