From patchwork Fri Nov 13 19:42:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1400071 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CXpl84Zwbz9sT6 for ; Sat, 14 Nov 2020 06:42:12 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D0AB13898007; Fri, 13 Nov 2020 19:42:09 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [IPv6:2a0c:e300::1]) by sourceware.org (Postfix) with ESMTPS id 22B22385041B for ; Fri, 13 Nov 2020 19:42:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 22B22385041B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 0DB1CDAF; Fri, 13 Nov 2020 20:42:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nKWTwv-1LZsG; Fri, 13 Nov 2020 20:42:05 +0100 (CET) Received: from function.youpi.perso.aquilenet.fr (unknown [IPv6:2a01:cb19:956:1b00:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id F3994B57; Fri, 13 Nov 2020 20:42:04 +0100 (CET) Received: from samy by function.youpi.perso.aquilenet.fr with local (Exim 4.94) (envelope-from ) id 1kdexO-007SM1-Mn; Fri, 13 Nov 2020 20:42:02 +0100 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [PATCH] Add {,sysdep-}ld-library-path make variable Date: Fri, 13 Nov 2020 20:42:02 +0100 Message-Id: <20201113194202.1777248-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_NEUTRAL, 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: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On GNU/Hurd we not only need $(common-objpfx) in LD_LIBRARY_PATH when loading dynamic objects, but also $(common-objpfx)/mach and $(common-objpfx)/hurd. This adds an ld-library-path variable to be used as LD_LIBRARY_PATH basis in Makefiles, and a sysdep-ld-library-path variable for sysdeps to add some more paths, here mach/ and hurd/. --- Makeconfig | 3 +++ dlfcn/Makefile | 2 +- elf/Makefile | 4 ++-- inet/Makefile | 2 +- nptl/Makefile | 2 +- sysdeps/mach/hurd/Makeconfig | 2 ++ 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Makeconfig b/Makeconfig index dfda418aac..febdb3cece 100644 --- a/Makeconfig +++ b/Makeconfig @@ -769,6 +769,9 @@ built-program-cmd = $(built-program-cmd-before-env) $(run-program-env) \ # the second dependency of the makefile target in which # $(host-built-program-cmd) is used. host-built-program-cmd = $(run-via-rtld-prefix) $(built-program-file) +# $(ld-library-path) is the common content to be set in LD_LIBRARY_PATH +# for running static binaries that may load dynamic objects. +ld-library-path = $(objpfx):$(common-objpfx)$(sysdep-ld-library-path) ifndef LD LD := ld -X diff --git a/dlfcn/Makefile b/dlfcn/Makefile index 4b7e0387b3..412e7c57d5 100644 --- a/dlfcn/Makefile +++ b/dlfcn/Makefile @@ -52,7 +52,7 @@ ifeq (yes,$(build-shared)) tests += tststatic tststatic2 tststatic3 tststatic4 tststatic5 tests-static += tststatic tststatic2 tststatic3 tststatic4 tststatic5 modules-names += modstatic modstatic2 modstatic3 modstatic5 -tststatic-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf +tststatic-ENV = LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)elf tststatic2-ENV = $(tststatic-ENV) tststatic3-ENV = $(tststatic-ENV) tststatic4-ENV = $(tststatic-ENV) diff --git a/elf/Makefile b/elf/Makefile index f10cc59e7c..042fb569e3 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -178,7 +178,7 @@ tests-static := $(tests-static-normal) $(tests-static-internal) ifeq (yes,$(build-shared)) tests-static += tst-tls9-static tst-single_threaded-static-dlopen static-dlopen-environment = \ - LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn + LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)dlfcn tst-tls9-static-ENV = $(static-dlopen-environment) tst-single_threaded-static-dlopen-ENV = $(static-dlopen-environment) @@ -1669,7 +1669,7 @@ $(objpfx)tst-libc_dlvsym-dso.so: $(libsupport) $(libdl) $(objpfx)tst-libc_dlvsym.out: $(objpfx)tst-libc_dlvsym-dso.so $(objpfx)tst-libc_dlvsym-static: $(common-objpfx)dlfcn/libdl.a tst-libc_dlvsym-static-ENV = \ - LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn + LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)dlfcn $(objpfx)tst-libc_dlvsym-static.out: $(objpfx)tst-libc_dlvsym-dso.so $(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so diff --git a/inet/Makefile b/inet/Makefile index 7a807fe805..a32c433dc3 100644 --- a/inet/Makefile +++ b/inet/Makefile @@ -123,5 +123,5 @@ endif # The test uses dlopen indirectly and would otherwise load system # objects. tst-idna_name_classify-ENV = \ - LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf + LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx):$(common-objpfx)elf $(objpfx)tst-idna_name_classify.out: $(gen-locales) diff --git a/nptl/Makefile b/nptl/Makefile index f4134916b2..74ab758c12 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -614,7 +614,7 @@ tst-audit-threads-ENV = LD_AUDIT=$(objpfx)tst-audit-threads-mod1.so # The test uses dlopen indirectly and would otherwise load system # objects. tst-setuid1-static-ENV = \ - LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)elf:$(common-objpfx)nss + LD_LIBRARY_PATH=$(ld-library-path):$(common-objpfx)elf:$(common-objpfx)nss # The tests here better do not run in parallel. ifeq ($(run-built-tests),yes) diff --git a/sysdeps/mach/hurd/Makeconfig b/sysdeps/mach/hurd/Makeconfig index fe3b7c553e..959f23ec12 100644 --- a/sysdeps/mach/hurd/Makeconfig +++ b/sysdeps/mach/hurd/Makeconfig @@ -5,3 +5,5 @@ static-start-installed-name = crt0.o # GNU libc on the Hurd is always reentrant. libc-reentrant = yes + +sysdep-ld-library-path = :$(common-objpfx)/mach:$(common-objpfx)/hurd