]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add libc ABI extension kludge for baseline-violating libdl symbols
authorFlorian Weimer <fweimer@redhat.com>
Wed, 2 Jun 2021 05:32:19 +0000 (07:32 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Wed, 2 Jun 2021 05:34:24 +0000 (07:34 +0200)
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 fixed 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.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
scripts/versions.awk
sysdeps/unix/sysv/linux/hppa/Versions
sysdeps/unix/sysv/linux/ia64/Versions
sysdeps/unix/sysv/linux/sh/Versions
sysdeps/unix/sysv/linux/sparc/sparc64/Versions

index a7154480e321ae7d7025a51860d9d346598ab5ac..565233e5297e5eaf6b77e0eacb58e75e4550a30e 100644 (file)
@@ -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_pre_versions/ {
+    libc_pre_versions_active = 1;
+}
+
+function libc_pre_versions() {
+    # 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_pre_versions_active) {
+         veryoldver = libc_pre_versions();
+      } else {
+         veryoldver = "";
+      }
       printf(" %s.map", oldlib);
     }
     if ($2 != oldver) {
index 9532d207fc33bea64b7719e3bf4f9853d241495d..357c68a78240dc4d33a397202bfb860f9e628356 100644 (file)
@@ -1,3 +1,4 @@
+!libc_pre_versions
 libc {
   GLIBC_2.1 {
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
index 54e7723ca42c2d566bd10b4d6549f928643f65d6..f438b12587106281e48539cc0a05b95ead236e93 100644 (file)
@@ -1,3 +1,4 @@
+!libc_pre_versions
 libc {
   GLIBC_2.2 {
     ioperm; iopl;
index 19ba1d8d91dcca83594f61334661a00c76820b29..9c734ff755f44252e22949d4ea385e3c274bf751 100644 (file)
@@ -1,3 +1,4 @@
+!libc_pre_versions
 libc {
   GLIBC_2.2 {
     # functions used in other libraries
index fbea1bb2efd06bf7c25cc75a74ed9c3423528047..33b6779ec59b962b26f571bd81dea3debbac0954 100644 (file)
@@ -1,3 +1,4 @@
+!libc_pre_versions
 libc {
   GLIBC_2.0 {
     # Exception handling support functions from libgcc