From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 3E6F0386FC11 for ; Wed, 19 May 2021 18:04:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3E6F0386FC11 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-565-sHQdGHkQOYa-u4F9XNOL3g-1; Wed, 19 May 2021 14:04:27 -0400 X-MC-Unique: sHQdGHkQOYa-u4F9XNOL3g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 347A59F7C4 for ; Wed, 19 May 2021 18:04:26 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-137.ams2.redhat.com [10.36.112.137]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6CA2410023AC for ; Wed, 19 May 2021 18:04:25 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 02/14] Add libc ABI extension kludge for baseline-violating libdl symbols In-Reply-To: References: X-From-Line: 625ba510fb0c4c9b5d02fc1d7da7c71a972e6fd0 Mon Sep 17 00:00:00 2001 Message-Id: <625ba510fb0c4c9b5d02fc1d7da7c71a972e6fd0.1621446837.git.fweimer@redhat.com> Date: Wed, 19 May 2021 20:04:23 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 18:04:30 -0000 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