RFC: Add GNU_PROPERTY_1_GLIBC_2_NEEDED

Florian Weimer fweimer@redhat.com
Tue Oct 26 15:25:55 GMT 2021


* 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?

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
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 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>

Thanks,
Florian



More information about the Binutils mailing list