From patchwork Thu Jun 10 08:23:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 43803 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 992483AAA0A7 for ; Thu, 10 Jun 2021 08:24:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 992483AAA0A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623313447; bh=ODLwshrqFHkaul14J0FM9Jna1SMed62VNZOvSRvoGkY=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=gZkSSM6GErlzNKTZo2ZZTvrhVEmpQbsJr+5J8xH6AmotlbNj8MzzXIIYxI15bpV2+ vj4M78vEXD2QmarER8Z9KSjHhvfv2yOxXqTBFF35yOfYL9u5W/2ya4zQHPXAQYb+DG BahSrL48PElCIAS//tsmiVO7RWFbyxhC7jiFxI+g= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 4B2E93AAA066 for ; Thu, 10 Jun 2021 08:23:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4B2E93AAA066 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-244-k1kG7NncOJmW_DRacDqrag-1; Thu, 10 Jun 2021 04:23:05 -0400 X-MC-Unique: k1kG7NncOJmW_DRacDqrag-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2A8201012583 for ; Thu, 10 Jun 2021 08:23:05 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-115-60.ams2.redhat.com [10.36.115.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E18C5C1C5 for ; Thu, 10 Jun 2021 08:23:04 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 1/4] nptl_db: Install libthread_db under a regular implementation name In-Reply-To: References: X-From-Line: 33e06caaa6f9da0321f68d47090164b804429f2a Mon Sep 17 00:00:00 2001 Message-Id: <33e06caaa6f9da0321f68d47090164b804429f2a.1623312996.git.fweimer@redhat.com> Date: Thu, 10 Jun 2021 10:23:02 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.6 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-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Currently, the name is always libthread_db-1.0.so. It does not change with the glibc version, like the other libraries. GDB hard-codes libthread_db.so.1 (the soname), so this change does not affect loading libthread_db. Tested on x86_64-linux-gnu, in an environment where the nptl GDB tests actually run. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- nptl_db/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/nptl_db/Makefile b/nptl_db/Makefile index ea721c1dcf..1f79c018a1 100644 --- a/nptl_db/Makefile +++ b/nptl_db/Makefile @@ -21,8 +21,6 @@ subdir := nptl_db include ../Makeconfig -nptl_db-version = 1.0 - extra-libs = libthread_db extra-libs-others := $(extra-libs) From patchwork Thu Jun 10 08:23:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 43804 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 653693AAA0A7 for ; Thu, 10 Jun 2021 08:24:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 653693AAA0A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623313492; bh=ud+/FOYUPzAD4cP/FMTIiVSepapuR0lmTAizs3ow3x0=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=SL/7DvrBtKFNEa+ZtGYpiVl2OWOeTCDc9ZH87GAk1h/72rdmqXJCJToDEMV9RW5qM Ywk2456P8WOPBSqDG2jaW0r+y4A5fJcfo3yf+JNsug0a1YvZFIrYEVfcs7GnVRmrZ2 5LAn2dCnIHk2VGmaiWKWNMsnsOJF3cD46X02Thvk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 1F2B3389683C for ; Thu, 10 Jun 2021 08:23:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1F2B3389683C 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-371-LXy_VLMmO6OcOyoDvsFoew-1; Thu, 10 Jun 2021 04:23:10 -0400 X-MC-Unique: LXy_VLMmO6OcOyoDvsFoew-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CC51A1012591 for ; Thu, 10 Jun 2021 08:23:09 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-115-60.ams2.redhat.com [10.36.115.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E8035D6AD for ; Thu, 10 Jun 2021 08:23:09 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 2/4] Makerules: Remove lib-version, $(subdir-version) In-Reply-To: References: X-From-Line: 6f0697cc5bf2ed21b74e0e43f2fda120c7993127 Mon Sep 17 00:00:00 2001 Message-Id: <6f0697cc5bf2ed21b74e0e43f2fda120c7993127.1623312996.git.fweimer@redhat.com> Date: Thu, 10 Jun 2021 10:23:07 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.6 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-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Also clarify that the “versioned” term refers to the soname, not the glibc version (which also ends up in the installed file name). I verified on x86_64-linux-gnu that “make install” produces the same files. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- Makerules | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/Makerules b/Makerules index ca9885436e..d3f29d0b89 100644 --- a/Makerules +++ b/Makerules @@ -982,22 +982,21 @@ install-lib.so := $(filter %.so,$(install-lib:%_pic.a=%.so)) install-lib := $(filter-out %.so %_pic.a,$(install-lib)) ifeq (yes,$(build-shared)) -# Find which .so's have versions. +# Find which .so's have a version number in their soname. versioned := $(strip $(foreach so,$(install-lib.so),\ $(patsubst %,$(so),$($(so)-version)))) install-lib.so-versioned := $(filter $(versioned), $(install-lib.so)) install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so)) -# For versioned libraries, we install three files: +# For libraries whose soname have version numbers, we install three files: # $(inst_libdir)/libfoo.so -- for linking, symlink or ld script # $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink # $(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file -lib-version := $(firstword $($(subdir)-version) $(version)) install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \ $(foreach L,$(install-lib.so-versioned),\ $(inst_libdir)/$L \ - $(inst_slibdir)/$(L:.so=)-$(lib-version).so \ + $(inst_slibdir)/$(L:.so=)-$(version).so \ $(inst_slibdir)/$L$($L-version)) # Install all the unversioned shared libraries. @@ -1125,7 +1124,6 @@ include $(o-iterator) generated += $(foreach o,$(versioned),$o$($o-version)) -ifeq (,$($(subdir)-version)) define o-iterator-doit $(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \ $(+force); @@ -1140,23 +1138,7 @@ $(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force); endef object-suffixes-left := $(versioned) include $(o-iterator) -else -define o-iterator-doit -$(inst_slibdir)/$o$($o-version): \ - $(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so $(+force); - $$(make-shlib-link) -endef -object-suffixes-left := $(versioned) -include $(o-iterator) - -define o-iterator-doit -$(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o $(+force); - $$(do-install-program) -endef -object-suffixes-left := $(versioned) -include $(o-iterator) -endif -endif +endif # ifneq (,$(versioned)) define do-install-so $(do-install-program) From patchwork Thu Jun 10 08:23:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 43805 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 949F03AAA0AB for ; Thu, 10 Jun 2021 08:25:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 949F03AAA0AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623313537; bh=9oyGzXZU+6XEqj/lQoul5Tlb/cu1C6O0fnK+jakoxNk=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ei75NJUA2P8q3fAD+6RUoNKSc3GRIa70frjHQKQstUadpCc1QUyxzLqlLU/KPNsAG NWZRDhpxTdxd1f7L/cegRqGntQYlBIiF4HlX9nS9UvOAFQtTDARCMXcWPtijTinmyW fghA0XAwPmho3mdsrVrN9XylOurOpLPKG16Q5DpQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 250463AAA09D for ; Thu, 10 Jun 2021 08:23:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 250463AAA09D 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-104-vSyQ_waeOtG4Kng4KLTneQ-1; Thu, 10 Jun 2021 04:23:15 -0400 X-MC-Unique: vSyQ_waeOtG4Kng4KLTneQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C0DB8015A4 for ; Thu, 10 Jun 2021 08:23:14 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-115-60.ams2.redhat.com [10.36.115.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2F365C1C5 for ; Thu, 10 Jun 2021 08:23:13 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 3/4] elf: Generalize name-based DSO recognition in ldconfig In-Reply-To: References: X-From-Line: f1b7632ac80967bc23998c05f5a7c4d76c6e779c Mon Sep 17 00:00:00 2001 Message-Id: Date: Thu, 10 Jun 2021 10:23:11 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This introduces and the _dl_is_dso function. A test ensures that the official names of libc.so, ld.so, and their versioned names are recognized. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- elf/Makefile | 2 +- elf/dl-is_dso.h | 33 +++++++++++++++++++++++++++++++++ elf/ldconfig.c | 5 ++--- elf/tst-dl-is_dso.c | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 elf/dl-is_dso.h create mode 100644 elf/tst-dl-is_dso.c diff --git a/elf/Makefile b/elf/Makefile index 5c47daee12..1751f5ec67 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -223,7 +223,7 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \ tst-single_threaded tst-single_threaded-pthread \ tst-tls-ie tst-tls-ie-dlmopen argv0test \ tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \ - tst-tls20 tst-tls21 tst-dlmopen-dlerror + tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dl-is_dso # reldep9 tests-internal += loadtest unload unload2 circleload1 \ neededtest neededtest2 neededtest3 neededtest4 \ diff --git a/elf/dl-is_dso.h b/elf/dl-is_dso.h new file mode 100644 index 0000000000..94e00966a1 --- /dev/null +++ b/elf/dl-is_dso.h @@ -0,0 +1,33 @@ +/* Heuristic for recognizing DSO file names. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +/* Returns true if the file name looks like a DSO name. */ +static bool +_dl_is_dso (const char *name) +{ + /* Recognize lib*.so*, ld-*.so*, ld.so.*, ld64.so.*. ld-*.so* + matches both platform dynamic linker names like ld-linux.so.2, + and versioned dynamic loader names like ld-2.12.so. */ + return (((strncmp (name, "lib", 3) == 0 || strncmp (name, "ld-", 3) == 0) + && strstr (name, ".so") != NULL) + || strncmp (name, "ld.so.", 6) == 0 + || strncmp (name, "ld64.so.", 8) == 0); +} diff --git a/elf/ldconfig.c b/elf/ldconfig.c index 96bf7700b2..1037e8d0cf 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -842,9 +843,7 @@ search_dir (const struct dir_entry *entry) subdirectory (if not already processing a glibc-hwcaps subdirectory)? The dynamic linker is also considered as shared library. */ - if (((strncmp (direntry->d_name, "lib", 3) != 0 - && strncmp (direntry->d_name, "ld-", 3) != 0) - || strstr (direntry->d_name, ".so") == NULL) + if (!_dl_is_dso (direntry->d_name) && (direntry->d_type == DT_REG || (entry->hwcaps == NULL && !is_hwcap_platform (direntry->d_name)))) diff --git a/elf/tst-dl-is_dso.c b/elf/tst-dl-is_dso.c new file mode 100644 index 0000000000..48d2cc9fbe --- /dev/null +++ b/elf/tst-dl-is_dso.c @@ -0,0 +1,35 @@ +/* Test heuristic for recognizing DSO file names. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +static int +do_test (void) +{ + /* Official ABI names. */ + TEST_VERIFY (_dl_is_dso (LIBC_SO)); + TEST_VERIFY (_dl_is_dso (LD_SO)); + /* Version-based names. The version number does not matter. */ + TEST_VERIFY (_dl_is_dso ("libc-2.12.so")); + TEST_VERIFY (_dl_is_dso ("ld-2.12.so")); + return 0; +} + +#include From patchwork Thu Jun 10 08:23:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 43806 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9CC8E3AAA0AA for ; Thu, 10 Jun 2021 08:26:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9CC8E3AAA0AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623313582; bh=V1y187OhG/tDQyymCwa1cwjPv4jrbmsFzV8/FgCIMr4=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=J2g9Pwz2GoJyzTqmOFgLOwn4XHxhQMCA6KWho052UbG1iKlYhjhFDSW16lov4exE5 vq6K/hwsbVXQk20aTcEBqZ0VW6IDbEHaiMi84O5Y2azfSu3bkeIQDtju5XmpdejLd3 9MIOlH/2xT8Sf7Igo/llsFQ5d28Bd7YGcIJxPoo8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 C06343AAA09F for ; Thu, 10 Jun 2021 08:23:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C06343AAA09F 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-561-HeleBkfqMIaseNvnFRxiHw-1; Thu, 10 Jun 2021 04:23:20 -0400 X-MC-Unique: HeleBkfqMIaseNvnFRxiHw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 872591012582 for ; Thu, 10 Jun 2021 08:23:19 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-115-60.ams2.redhat.com [10.36.115.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADE829CA0 for ; Thu, 10 Jun 2021 08:23:18 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 4/4] Install shared objects under their ABI names In-Reply-To: References: X-From-Line: eae14c3d57b3fef43892ca304f2d8017555e8447 Mon Sep 17 00:00:00 2001 Message-Id: Date: Thu, 10 Jun 2021 10:23:16 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.9 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, URIBL_BLACK 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-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Previously, the installed objects were named like libc-2.33.so, and the ABI soname libc.so.6 was just a symbolic link. The Makefile targets to install these symbolic links are no longer needed after this, so they are removed with this commit. The more general $(make-link) command (which invokes scripts/rellns-sh) is retained because other symbolic links are still needed. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- INSTALL | 10 ++++++++++ Makefile | 6 ------ Makerules | 45 +++++---------------------------------------- NEWS | 8 ++++++++ elf/Makefile | 10 ++-------- 5 files changed, 25 insertions(+), 54 deletions(-) diff --git a/INSTALL b/INSTALL index bc761ab98b..ed5f66489b 100644 --- a/INSTALL +++ b/INSTALL @@ -199,6 +199,16 @@ if 'CFLAGS' is specified it must enable optimization. For example: RELRO and a read-only global offset table (GOT), at the cost of slightly increased program load times. +'--disable-major-minor-libraries' + Do not install shared objects under file names that contain the + major and minor version of the GNU C Library. By default, such + names are used, and the names defined by the ABI are provided as + symbolic links only. This causes problems with certain package + managers during library upgrades and (in particular) downgrades, so + this option can be used to install these shared objects directly + under their ABI-defined names, without an additional indirection + via symbolic links. + '--enable-pt_chown' The file 'pt_chown' is a helper binary for 'grantpt' (*note Pseudo-Terminals: Allocation.) that is installed setuid root to fix diff --git a/Makefile b/Makefile index 242d36de91..c115c652a0 100644 --- a/Makefile +++ b/Makefile @@ -109,12 +109,6 @@ elf/ldso_install: # Ignore the error if we cannot update /etc/ld.so.cache. ifeq (no,$(cross-compiling)) ifeq (yes,$(build-shared)) -install: install-symbolic-link -.PHONY: install-symbolic-link -install-symbolic-link: subdir_install - $(symbolic-link-prog) $(symbolic-link-list) - rm -f $(symbolic-link-list) - install: -test ! -x $(elf-objpfx)ldconfig || LC_ALL=C \ $(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \ diff --git a/Makerules b/Makerules index d3f29d0b89..6efff78fbe 100644 --- a/Makerules +++ b/Makerules @@ -989,14 +989,12 @@ versioned := $(strip $(foreach so,$(install-lib.so),\ install-lib.so-versioned := $(filter $(versioned), $(install-lib.so)) install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so)) -# For libraries whose soname have version numbers, we install three files: +# For libraries whose soname have version numbers, we install two files: # $(inst_libdir)/libfoo.so -- for linking, symlink or ld script -# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink -# $(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file +# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \ $(foreach L,$(install-lib.so-versioned),\ $(inst_libdir)/$L \ - $(inst_slibdir)/$(L:.so=)-$(version).so \ $(inst_slibdir)/$L$($L-version)) # Install all the unversioned shared libraries. @@ -1029,35 +1027,10 @@ ln -f $(objpfx)/$(@F) $@ endef endif -ifeq (yes,$(build-shared)) -ifeq (no,$(cross-compiling)) -symbolic-link-prog := $(elf-objpfx)sln -symbolic-link-list := $(elf-objpfx)symlink.list -define make-shlib-link -echo `$(..)scripts/rellns-sh -p $< $@` $@ >> $(symbolic-link-list) -endef -else # cross-compiling -# We need a definition that can be used by elf/Makefile's install rules. -symbolic-link-prog = $(LN_S) -endif -endif -ifndef make-shlib-link -define make-shlib-link -rm -f $@ -$(LN_S) `$(..)scripts/rellns-sh -p $< $@` $@ -endef -endif - ifdef libc.so-version -# For a library specified to be version N, install three files: -# libc.so -> libc.so.N (e.g. libc.so.6) -# libc.so.6 -> libc-VERSION.so (e.g. libc-1.10.so) - -$(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \ - $(+force) - $(make-shlib-link) -$(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force) +$(inst_slibdir)/libc.so$(libc.so-version): $(common-objpfx)libc.so $(+force) $(do-install-program) + install: $(inst_slibdir)/libc.so$(libc.so-version) # This fragment of linker script gives the OUTPUT_FORMAT statement @@ -1125,15 +1098,7 @@ include $(o-iterator) generated += $(foreach o,$(versioned),$o$($o-version)) define o-iterator-doit -$(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \ - $(+force); - $$(make-shlib-link) -endef -object-suffixes-left := $(versioned) -include $(o-iterator) - -define o-iterator-doit -$(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force); +$(inst_slibdir)/$o$($o-version): $(objpfx)$o $(+force); $$(do-install-program) endef object-suffixes-left := $(versioned) diff --git a/NEWS b/NEWS index 1bf3daa502..1634e20ce5 100644 --- a/NEWS +++ b/NEWS @@ -48,6 +48,14 @@ Deprecated and removed features, and other changes affecting compatibility: * The function pthread_yield has been deprecated; programs should use the equivalent standard function sched_yield instead. +* Previously, glibc installed its various shared objects under versioned + file names such as libc-2.33.so. The ABI sonames (e.g., libc.so.6) + were provided as symbolic links. Starting with glibc 2.34, the shared + objects are installed under their ABI sonames directly, without + symbolic links. This increases compatibility with distribution + package managers that delete removed files late during the package + upgrade or downgrade process. + Changes to build and runtime requirements: * On Linux, the shm_open, sem_open, and related functions now expect the diff --git a/elf/Makefile b/elf/Makefile index 1751f5ec67..02f634c192 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -628,20 +628,14 @@ $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx). ifeq (yes,$(build-shared)) -$(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force) +$(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force) $(make-target-directory) $(do-install-program) -$(inst_rtlddir)/$(rtld-installed-name): \ - $(inst_slibdir)/$(rtld-version-installed-name) \ - $(inst_slibdir)/libc-$(version).so - $(make-target-directory) - $(make-shlib-link) - # Special target called by parent to install just the dynamic linker. .PHONY: ldso_install ldso_install: $(inst_rtlddir)/$(rtld-installed-name) -endif +endif # $(build-shared) # Workarounds for ${exec_prefix} expansion in configure variables.