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 02/14] Add libc ABI extension kludge for baseline-violating libdl symbols
Date: Wed, 19 May 2021 20:04:23 +0200	[thread overview]
Message-ID: <625ba510fb0c4c9b5d02fc1d7da7c71a972e6fd0.1621446837.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1621446837.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 of affected symbols and the essentially fixed set,
no generic mechanism is implemented, and instead the map file
fragment is hard-coded in scripts/versions.mk.  Listing not-yet-moved
symbols in this fragment does not change the libc ABI.

The compat_symbol macro already emits the appropriate version strings,
so no adjustments are needed there.
---
 scripts/versions.awk                          | 36 +++++++++++++++++--
 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, 38 insertions(+), 2 deletions(-)

diff --git a/scripts/versions.awk b/scripts/versions.awk
index 3291123666..3b829929c2 100644
--- a/scripts/versions.awk
+++ b/scripts/versions.awk
@@ -93,6 +93,33 @@ 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() {
+    printf("\
+GLIBC_2.0 {\n\
+  global:\n\
+    dladdr;\n\
+    dlclose;\n\
+    dlerror;\n\
+    dlopen;\n\
+    dlsym;\n\
+  local:\n\
+    *;\n\
+};\n\
+GLIBC_2.1 {\n\
+  global:\n\
+    dlopen;\n\
+    dlvsym;\n\
+} GLIBC_2.0;\n\
+") > outfile;
+    return "GLIBC_2.1";
+}
 
 function closeversion(name, oldname) {
   if (firstinfile) {
@@ -157,8 +184,13 @@ END {
       oldlib = $1;
       real_outfile = buildroot oldlib ".map";
       outfile = real_outfile "T";
-      firstinfile = 1;
-      veryoldver = "";
+      if ($1 == "libc" && libc_abi_extension_active) {
+	  firstinfile = 0;
+	  veryoldver = libc_abi_extension();
+      } else {
+	  firstinfile = 1;
+	  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 214e6f9f1a..f56da206ea 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 e0938c4165..cc57722681 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-19 18:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 18:03 [PATCH 00/14] Move libdl into libc Florian Weimer
2021-05-19 18:04 ` [PATCH 01/14] stdio-common: Remove _IO_vfwscanf Florian Weimer
2021-05-19 18:04 ` Florian Weimer [this message]
2021-05-19 18:04 ` [PATCH 03/14] dlfcn: Move dlerror into libc Florian Weimer
2021-05-19 18:04 ` [PATCH 04/14] dlfcn: Move dlclose " Florian Weimer
2021-05-19 18:04 ` [PATCH 05/14] dlfcn: Move dladdr " Florian Weimer
2021-05-19 18:04 ` [PATCH 06/14] dlfcn: Move dlsym " Florian Weimer
2021-05-19 18:04 ` [PATCH 07/14] dlfcn: Move dlmopen " Florian Weimer
2021-05-19 18:04 ` [PATCH 08/14] dlfcn: Move dladdr1 " Florian Weimer
2021-05-19 18:04 ` [PATCH 09/14] dlfcn: Move dlinfo " Florian Weimer
2021-05-19 18:05 ` [PATCH 10/14] dlfcn: Move dlvsym " Florian Weimer
2021-05-19 18:05 ` [PATCH 11/14] dlfcn: Move dlopen " Florian Weimer
2021-05-19 18:05 ` [PATCH 12/14] dlfcn: Cleanups after -ldl is no longer required Florian Weimer
2021-05-19 18:05 ` [PATCH 13/14] dlfcn: Eliminate GLIBC_PRIVATE dependency from tststatic2 Florian Weimer
2021-05-19 18:05 ` [PATCH 14/14] dlfcn: Rework static dlopen hooks Florian Weimer
2021-05-21 19:17 ` [PATCH 00/14] Move libdl into libc Florian Weimer
2021-05-22 17:16   ` Florian Weimer
2021-05-25 14:44 [PATCH v2 " Florian Weimer
2021-05-25 14:44 ` [PATCH 02/14] Add libc ABI extension kludge for baseline-violating libdl symbols 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=625ba510fb0c4c9b5d02fc1d7da7c71a972e6fd0.1621446837.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).