public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [RFC 0/2] Transparent multi-version symbol support
Date: Thu, 18 Mar 2021 21:06:52 +0100	[thread overview]
Message-ID: <cover.1616095061.git.fweimer@redhat.com> (raw)

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


             reply	other threads:[~2021-03-18 20:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 20:06 Florian Weimer [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1616095061.git.fweimer@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).