From patchwork Sat Feb 8 16:09:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andreas K. Huettel" X-Patchwork-Id: 106165 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com 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 3C8C3385840C for ; Sat, 8 Feb 2025 16:11:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C8C3385840C X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 838853858D38 for ; Sat, 8 Feb 2025 16:10:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 838853858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 838853858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739031023; cv=none; b=XbgJXrC7WOXywaYQ7nG9/7w69xTv+wpMwAs5z4FQt2YbxVmis8B6H65zr75OUtrn7KxXjEmWAsfG/ohdmg6xNQCysMB6UKPtretnp73nZOQaRA1f3gfdPpuqp7O2PqnWoUtaTG8GpA5V5SzSD7+jalTkXqZl5XimsZ0gGYPTof0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739031023; c=relaxed/simple; bh=cCqKzEujmbuuozzTv5mgTPxHXdRg/lKso/wQ1KZGvAM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=T9CWk44zb8rfu7BOxgiOuI7nMia19rmaLBNPyrK64KoGu4AmSzp/PYhthySqQdNL4MwZcnikGIbb9HV2cbZxNmtjtjWCEYjn/HyVxFn6sq6j6S6C2eGR0iIuf2D4XflMwynrnNVAhOqxtnwKclHcxENqNloz0CkHMbxtqzJsnbg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 838853858D38 Received: from noumea.fritz.box (p200300e5cf2b5600c5c897a38f8e068e.dip0.t-ipconnect.de [IPv6:2003:e5:cf2b:5600:c5c8:97a3:8f8e:68e]) (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) (Authenticated sender: dilfridge@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 2AF32340C40; Sat, 08 Feb 2025 16:10:19 +0000 (UTC) From: =?utf-8?q?Andreas_K=2E_H=C3=BCttel?= To: libc-alpha@sourceware.org Cc: =?utf-8?q?Andreas_K=2E_H=C3=BCttel?= Subject: [PATCH v2 1/4] Makeconfig: Add libgcc directory to rtld-prefix search path Date: Sat, 8 Feb 2025 17:09:01 +0100 Message-ID: <20250208160937.3955501-1-dilfridge@gentoo.org> X-Mailer: git-send-email 2.45.3 MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org * This needs to be done twice, for test runs with and without --enable-hardcoded-path-in-tests * Also, we need to query the used $(CC) for the library location. * The container tests run ldd and dump the list of needed libraries, then copy these into the container. * Without this patch, ldd may not find libgcc_s.so, resulting in"not found" output and no copying of the library. * With this patch, the library is picked up independent of its location (as long as the proper directory is provided) and copied into the testroot. * This does not mean yet that ld.so in the testroot actually finds it. Signed-off-by: Andreas K. Hüttel --- Makeconfig | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makeconfig b/Makeconfig index d0108d2caa..0820f860b2 100644 --- a/Makeconfig +++ b/Makeconfig @@ -635,7 +635,7 @@ link-libc-printers-tests = $(link-libc-rpath) \ # This is how to find at build-time things that will be installed there. rpath-dirs = math elf dlfcn nss nis rt resolv mathvec support rpath-link = \ -$(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%))) +$(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%))):$(gnulib-extralibdir) else # build-static link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib) link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests) @@ -692,6 +692,11 @@ link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnuli # some cases and it is preferable to link with libgcc_eh or libgcc_s # so that the testing is as similar as possible to how programs will # be built with the installed glibc. +# This leads to moderate difficulties, also since distributions may +# install libgcc_s.so in directories only found via ld.so.conf, e.g. +# to be able to switch between gcc versions. We need to add the +# corresponding directory to the library search path to make sure +# our test programs can find it. # # Some architectures have architecture-specific systems for exception # handling that may involve undefined references to @@ -709,6 +714,7 @@ libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed gnulib-arch = gnulib = -lgcc $(gnulib-arch) gnulib-tests := -lgcc $(libgcc_eh) +gnulib-extralibdir := $(shell dirname $$($(CC) -print-file-name=libgcc_s.so$(libgcc_s.so-version))) static-gnulib-arch = # By default, elf/static-stubs.o, instead of -lgcc_eh, is used to # statically link programs. When --disable-shared is used, we use @@ -781,10 +787,12 @@ endif # How to run a program we just linked with our library. # The program binary is assumed to be $(word 2,$^). +# We may require additional libraries from gcc (e.g. libgcc_s.so for exception +# handling), which unfortunately somewhat breaks the isolation. built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^)) rtld-prefix = $(elf-objpfx)$(rtld-installed-name) \ --library-path \ - $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) + $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)):$(gnulib-extralibdir) ifeq (yes,$(build-shared)) comma = , sysdep-library-path = \