public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH v2 04/16] Add libc ABI extension kludge for baseline-violating libdl symbols
Date: Mon, 31 May 2021 16:11:34 +0200	[thread overview]
Message-ID: <84f59adc6d3b0b84d2ce8ab94e91e1a08a33989e.1622469908.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1622469908.git.fweimer@redhat.com>

Some targets have a GLIBC_2.0 baseline for libdl, while using
GLIBC_2.2 for libc.  This means that the generated libc.map file
does not have any version nodes for GLIBC_2.0 or GLIBC_2.1.  However,
moving symbols from libdl into libc needs such version nodes.
(Future symbol moves from librt will need this as well.)

This kludge is only necessary for symbols predating GLIBC_2.2 because
the affected targets use GLIBC_2.2 as the baseline for libc.  Given
the small number and fixexd set of affected architectures, no generic
mechanism is implemented, and instead the map file fragment is
hard-coded in scripts/versions.mk.

The compat_symbol macro already emits the appropriate version strings,
so no adjustments are needed there.
---
 scripts/versions.awk                          | 26 ++++++++++++++++++-
 sysdeps/unix/sysv/linux/hppa/Versions         |  1 +
 sysdeps/unix/sysv/linux/ia64/Versions         |  1 +
 sysdeps/unix/sysv/linux/sh/Versions           |  1 +
 .../unix/sysv/linux/sparc/sparc64/Versions    |  1 +
 5 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/scripts/versions.awk b/scripts/versions.awk
index a7154480e3..1e8d8e4dc5 100644
--- a/scripts/versions.awk
+++ b/scripts/versions.awk
@@ -93,6 +93,26 @@ function ord(c) {
   printf("%s %s %s\n", actlib, sortver, $0) | sort;
 }
 
+# Some targets do not set the ABI baseline for libdl.  As a result,
+# symbols originally in libdl need to be moved under historic symbol
+# versions, without altering the baseline version for libc itself.
+/^ *!libc_abi_extension/ {
+    libc_abi_extension_active = 1;
+}
+
+function libc_abi_extension() {
+    # No local: * here, so that we do not have to update this script
+    # if symbols are moved into libc.  The abilist files and the other
+    # targets (with a real GLIBC_2.0 baseline) provide testing
+    # coverage.
+    printf("\
+GLIBC_2.0 {\n\
+};\n\
+GLIBC_2.1 {\n\
+} GLIBC_2.0;\n\
+") > outfile;
+    return "GLIBC_2.1";
+}
 
 function closeversion(name, oldname) {
   printf("  local:\n    *;\n") > outfile;
@@ -154,7 +174,11 @@ END {
       oldlib = $1;
       real_outfile = buildroot oldlib ".map";
       outfile = real_outfile "T";
-      veryoldver = "";
+      if ($1 == "libc" && libc_abi_extension_active) {
+	  veryoldver = libc_abi_extension();
+      } else {
+	  veryoldver = "";
+      }
       printf(" %s.map", oldlib);
     }
     if ($2 != oldver) {
diff --git a/sysdeps/unix/sysv/linux/hppa/Versions b/sysdeps/unix/sysv/linux/hppa/Versions
index 9532d207fc..8969fc08af 100644
--- a/sysdeps/unix/sysv/linux/hppa/Versions
+++ b/sysdeps/unix/sysv/linux/hppa/Versions
@@ -1,3 +1,4 @@
+!libc_abi_extension
 libc {
   GLIBC_2.1 {
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
diff --git a/sysdeps/unix/sysv/linux/ia64/Versions b/sysdeps/unix/sysv/linux/ia64/Versions
index f6994151aa..7cac57a8e1 100644
--- a/sysdeps/unix/sysv/linux/ia64/Versions
+++ b/sysdeps/unix/sysv/linux/ia64/Versions
@@ -1,3 +1,4 @@
+!libc_abi_extension
 libc {
   GLIBC_2.2 {
     ioperm; iopl;
diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions
index 19ba1d8d91..fc89ff1c18 100644
--- a/sysdeps/unix/sysv/linux/sh/Versions
+++ b/sysdeps/unix/sysv/linux/sh/Versions
@@ -1,3 +1,4 @@
+!libc_abi_extension
 libc {
   GLIBC_2.2 {
     # functions used in other libraries
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/Versions b/sysdeps/unix/sysv/linux/sparc/sparc64/Versions
index fbea1bb2ef..3059d56f80 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/Versions
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/Versions
@@ -1,3 +1,4 @@
+!libc_abi_extension
 libc {
   GLIBC_2.0 {
     # Exception handling support functions from libgcc
-- 
2.31.1



  parent reply	other threads:[~2021-05-31 14:11 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 14:10 [PATCH v3 00/16] Move libdl into libc Florian Weimer
2021-05-31 14:11 ` [PATCH v2 01/16] stdio-common: Remove _IO_vfwscanf Florian Weimer
2021-05-31 19:42   ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 02/16] Add missing symbols to Version files Florian Weimer
2021-06-01 19:12   ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 03/16] scripts/versions.awk: Add local: * to all version nodes Florian Weimer
2021-06-01 19:23   ` Adhemerval Zanella
2021-05-31 14:11 ` Florian Weimer [this message]
2021-06-01 19:31   ` [PATCH v2 04/16] Add libc ABI extension kludge for baseline-violating libdl symbols Adhemerval Zanella
2021-06-01 19:34     ` Florian Weimer
2021-06-01 19:38       ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 05/16] dlfcn: Move dlerror into libc Florian Weimer
2021-06-01 19:36   ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 06/16] dlfcn: Move dlclose " Florian Weimer
2021-06-02 12:58   ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 07/16] dlfcn: Move dladdr " Florian Weimer
2021-06-02 14:02   ` Adhemerval Zanella
2021-05-31 14:11 ` [PATCH 08/16] dlfcn: Move dlsym " Florian Weimer
2021-06-02 14:12   ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 09/16] dlfcn: Move dlmopen " Florian Weimer
2021-06-02 14:19   ` Adhemerval Zanella
2021-06-02 14:37     ` Florian Weimer
2021-06-02 14:43       ` Adhemerval Zanella
2021-06-02 17:49     ` Florian Weimer
2021-06-02 18:00       ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 10/16] dlfcn: Move dladdr1 " Florian Weimer
2021-06-02 14:29   ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 11/16] dlfcn: Move dlinfo " Florian Weimer
2021-06-02 14:31   ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 12/16] dlfcn: Move dlvsym " Florian Weimer
2021-06-02 14:34   ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 13/16] dlfcn: Move dlopen " Florian Weimer
2021-06-02 14:54   ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 14/16] dlfcn: Cleanups after -ldl is no longer required Florian Weimer
2021-06-02 18:08   ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH v2 15/16] dlfcn: Eliminate GLIBC_PRIVATE dependency from tststatic2 Florian Weimer
2021-06-02 18:09   ` Adhemerval Zanella
2021-05-31 14:12 ` [PATCH 16/16] dlfcn: Rework static dlopen hooks Florian Weimer
2021-06-02 19:18   ` Adhemerval Zanella

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=84f59adc6d3b0b84d2ce8ab94e91e1a08a33989e.1622469908.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).