[02/14] Add libc ABI extension kludge for baseline-violating libdl symbols
Checks
Commit Message
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(-)
@@ -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) {
@@ -1,3 +1,4 @@
+!libc_abi_extension
libc {
GLIBC_2.1 {
_sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
@@ -1,3 +1,4 @@
+!libc_abi_extension
libc {
GLIBC_2.2 {
ioperm; iopl;
@@ -1,3 +1,4 @@
+!libc_abi_extension
libc {
GLIBC_2.2 {
# functions used in other libraries
@@ -1,3 +1,4 @@
+!libc_abi_extension
libc {
GLIBC_2.0 {
# Exception handling support functions from libgcc