public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [RFC 0/2] Transparent multi-version symbol support
@ 2021-03-18 20:06 Florian Weimer
  2021-03-18 20:07 ` [RFC 1/2] Change how the symbol_version_reference macro is defined Florian Weimer
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Florian Weimer @ 2021-03-18 20:06 UTC (permalink / raw)
  To: libc-alpha

This turned out to be way harder than it should be.  Older binutils does
not support multiple .symver directives for the same first symbol, so we
have various kludges like (from time/clock_settime.c):

| versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
| 
| /* clock_settime moved to libc in version 2.17;
|    old binaries may expect the symbol version it had in librt.  */
| #if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
| strong_alias (__clock_settime, __clock_settime_2);
| compat_symbol (libc, __clock_settime_2, clock_settime, GLIBC_2_2);
| #endif

I think I have found a way to do this with assembler hacks, so that it
applies to function and data symbols alike.  With this, the above
snipper becomes:

| versioned_symbol (libc, __clock_settime, clock_settime, GLIBC_2_17);
| 
| /* clock_settime moved to libc in version 2.17;
|    old binaries may expect the symbol version it had in librt.  */
| #if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_17)
| compat_symbol (libc, __clock_settime, clock_settime, GLIBC_2_2);
| #endif

So the explicit aliases are gone.

Built with build-many-glibcs.py with binutils 2.36 and 2.34.  Tested on
i686-linux-gnu and x86_64-linux-gnu with binutils 2.34 and 2.35.

The object files aren't unchanged due to the __malloc_initialize_hook
change (and presumably others, I haven't looked closely).

Thanks,
Florian

Florian Weimer (2):
  Change how the symbol_version_reference macro is defined
  Fold compat_symbol_unique functionality into compat_symbol

 config.h.in                   |  4 ++
 configure                     | 28 +++++++++++
 configure.ac                  | 21 +++++++++
 include/libc-symbols.h        | 21 +++------
 include/shlib-compat.h        | 55 +++++++---------------
 locale/lc-ctype.c             | 14 +++---
 malloc/malloc.c               |  2 +-
 nptl/libpthread-compat.c      | 16 +++----
 sysdeps/generic/libc-symver.h | 88 +++++++++++++++++++++++++++++++++++
 sysdeps/ia64/libc-symver.h    | 33 +++++++++++++
 time/clock_getcpuclockid.c    |  3 +-
 time/clock_getres.c           |  3 +-
 time/clock_gettime.c          |  3 +-
 time/clock_nanosleep.c        |  3 +-
 time/clock_settime.c          |  3 +-
 15 files changed, 219 insertions(+), 78 deletions(-)
 create mode 100644 sysdeps/generic/libc-symver.h
 create mode 100644 sysdeps/ia64/libc-symver.h

-- 
2.30.2


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-03-19 20:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 20:06 [RFC 0/2] Transparent multi-version symbol support Florian Weimer
2021-03-18 20:07 ` [RFC 1/2] Change how the symbol_version_reference macro is defined Florian Weimer
2021-03-19 18:47   ` Adhemerval Zanella
2021-03-18 20:07 ` [RFC 2/2] Fold compat_symbol_unique functionality into compat_symbol Florian Weimer
2021-03-18 21:37   ` Joseph Myers
2021-03-19 18:59   ` Adhemerval Zanella
2021-03-19 19:13     ` Florian Weimer
2021-03-19 19:34       ` Adhemerval Zanella
2021-03-19 20:10     ` Adhemerval Zanella
2021-03-19 20:17       ` Florian Weimer
2021-03-19 20:26         ` Adhemerval Zanella
2021-03-19 20:29           ` Florian Weimer
2021-03-19 20:33             ` Adhemerval Zanella
2021-03-19 20:33             ` Adhemerval Zanella
2021-03-19 19:02 ` [RFC 0/2] Transparent multi-version symbol support Adhemerval Zanella
2021-03-19 19:14   ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).