From patchwork Wed Sep 29 16:26:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Dasmohapatra X-Patchwork-Id: 45574 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 808CB3857C48 for ; Wed, 29 Sep 2021 16:32:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 808CB3857C48 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1632933163; bh=B61N4qxX5s0UE9g+jqii5JpySDOKqVv/1hyGozNfDyk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=eVLOhAoGcKBhFeYnSNodxVpBQwwJMcawKRKX8ytZc3TYOYS6vefg+kkARIB5BVtpV CovXug3w/L18prGtABS+RL5A95+kuMtbR+nfyBG3cs4O6wlRxFPmT9v1DAukF1KUMo QWdFMPE3Xkx4LfZEOwTo0sl+zVFlwkvHcgZqhbtA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by sourceware.org (Postfix) with ESMTPS id BC1E2385801D for ; Wed, 29 Sep 2021 16:26:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BC1E2385801D Received: from noise.cbg.collabora.co.uk (unknown [IPv6:2001:4d48:ad5c:ef00:8e70:5aff:fe59:c29c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 4F85F1F446D2 for ; Wed, 29 Sep 2021 17:26:50 +0100 (BST) To: libc-alpha@sourceware.org Subject: [RFC][PATCH v13 8/9] Drop DT_GNU_FLAGS_1/DF_GNU_1_UNIQUE from merged libraries Date: Wed, 29 Sep 2021 17:26:41 +0100 Message-Id: <20210929162642.21985-9-vivek@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210929162642.21985-1-vivek@collabora.com> References: <20210929162642.21985-1-vivek@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: =?utf-8?q?Vivek_Das=C2=A0Mohapatra_via_Libc-alpha?= From: Vivek Dasmohapatra Reply-To: =?utf-8?q?Vivek_Das=C2=A0Mohapatra?= Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The following extra-libs have been merged into libc proper: nptl/libpthread htl/libpthread dlfcn/libdl login/libutil resolv/libanl Since they now exist as contentless stubs to satisfy link requirements for older applications they do not need to be treated as part of the core libc cluster when opened in a secondary namespace. --- dlfcn/Makefile | 1 + extra-lib.mk | 25 +++++++++++++++++++++++++ htl/Makefile | 5 ++--- login/Makefile | 1 + nptl/Makefile | 4 +--- resolv/Makefile | 2 ++ 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/dlfcn/Makefile b/dlfcn/Makefile index 6bbfbb8344..13a2684b30 100644 --- a/dlfcn/Makefile +++ b/dlfcn/Makefile @@ -35,6 +35,7 @@ routines = \ libc_dlerror_result \ extra-libs-others := libdl +not-df-gnu-unique := libdl libdl-shared-only-routines += libdl-compat diff --git a/extra-lib.mk b/extra-lib.mk index 9051958ec0..3f17017879 100644 --- a/extra-lib.mk +++ b/extra-lib.mk @@ -101,11 +101,36 @@ $(objpfx)$(lib).so: $(firstword $($(lib)-map) \ $(addprefix $(common-objpfx), \ $(filter $(lib).map, \ $(version-maps)))) + +############################################################################ +# the following have had all functional contents merged back into libc and +# are no longer considered part of the implicitly DF_GNU_1_UNIQUE cluster: +# nptl/libpthread htl/libpthread dlfcn/libdl login/libutil resolv/libanl + +# NOTE: the mechanisms are reversed depending on linker support: +# If linker support is present, libraries get the unique flag by default and we +# _suppress_ this with the -z nounique parameter. +# If linker support is absent then the flag is _added_ via a hacked up extra +# object from the elf/ subdir to those DSOs that need it. + +# The not-df-gnu-unique variable should contain a space separated list of +# stub library names (eg pthread for libpthread.so) of extra-libs which should +# NOT have the uniqueness flag. +# It should be set in the Makefile of the relevant subdir: ifneq ($(ld-zunique),yes) +ifeq (,$(strip $(filter $(not-df-gnu-unique),$(lib)))) $(objpfx)$(lib).so: $(common-objpfx)/elf/dynamic-notes.os +else endif +else +ifneq (,$(strip $(filter $(not-df-gnu-unique),$(lib)))) +LDFLAGS-$(patsubst lib%,%,$(lib)).so += -Wl,-z,nounique +else endif +endif +############################################################################ +endif endif # This will define `libof-ROUTINE := LIB' for each of the routines. diff --git a/htl/Makefile b/htl/Makefile index c2a25dcd79..9a04ba2a5f 100644 --- a/htl/Makefile +++ b/htl/Makefile @@ -169,6 +169,7 @@ shared-only-routines = forward extra-libs := libpthread extra-libs-others := $(extra-libs) +not-df-gnu-unique := libpthread install-lib := libpthread.so install-lib-ldscripts := libpthread_syms.a @@ -202,10 +203,8 @@ $(inst_libdir)/libpthread_syms.a: $(srcdir)/libpthread_syms.a $(+force) libc-link.so = $(common-objpfx)libc.so extra-B-pthread.so = -B$(common-objpfx)htl/ +# Turn off DF_GNU_1_UNIQUE for libpthread now that it's a stub. LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst -ifeq ($(ld-zunique),yes) -LDFLAGS-pthread.so += -Wl,-z,unique -endif include ../Rules diff --git a/login/Makefile b/login/Makefile index 4e6b97734d..703b3f3bd0 100644 --- a/login/Makefile +++ b/login/Makefile @@ -50,6 +50,7 @@ ifeq ($(have-GLIBC_2.33),yes) # Empty compatibility library for old binaries. extra-libs := libutil extra-libs-others := $(extra-libs) +not-df-gnu-unique := libutil libutil-routines := libutil-compat libutil-shared-only-routines := libutil-compat diff --git a/nptl/Makefile b/nptl/Makefile index bd9bc193e6..015cbd0b96 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -27,6 +27,7 @@ headers := pthread.h semaphore.h bits/semaphore.h \ extra-libs := libpthread extra-libs-others := $(extra-libs) +not-df-gnu-unique := libpthread routines = \ alloca_cutoff \ @@ -376,9 +377,6 @@ CPPFLAGS-tst-pthread-gdb-attach-static.c := \ tst-pthread-gdb-attach-no-pie = yes LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst -ifeq ($(ld-zunique),yes) -LDFLAGS-pthread.so += -Wl,-z,unique -endif tests += tst-cancelx7 tst-cancelx17 tst-cleanupx4 diff --git a/resolv/Makefile b/resolv/Makefile index 59e599535c..56afc5c279 100644 --- a/resolv/Makefile +++ b/resolv/Makefile @@ -77,8 +77,10 @@ tests-internal += tst-inet_aton_exact generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace extra-libs := libresolv libnss_dns +not-df-gnu-unique := ifeq ($(have-thread-library),yes) extra-libs += libanl +not-df-gnu-unique += libanl routines += gai_sigqueue tests += \