public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: dilfridge@gentoo.org
To: libc-alpha@sourceware.org
Cc: "Andreas K. Hüttel" <dilfridge@gentoo.org>
Subject: [PATCH 1/4] Makeconfig: Add libgcc directory to rtld-prefix search path
Date: Wed, 22 Jan 2025 17:12:40 +0100	[thread overview]
Message-ID: <20250122161338.141291-2-dilfridge@gentoo.org> (raw)
In-Reply-To: <20250122161338.141291-1-dilfridge@gentoo.org>

From: Andreas K. Hüttel <dilfridge@gentoo.org>

Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
---
 Makeconfig | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Makeconfig b/Makeconfig
index d0108d2caa..6b4ebd1320 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -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 $(CC) -print-libgcc-file-name | sed -e 's:/libgcc.*$$::')
 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 = \
-- 
2.45.2


  reply	other threads:[~2025-01-22 16:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22 16:12 [RFC] Make containerized tests more robust (libgcc_s.so.1 not found) dilfridge
2025-01-22 16:12 ` dilfridge [this message]
2025-01-29 19:55   ` [PATCH 1/4] Makeconfig: Add libgcc directory to rtld-prefix search path Adhemerval Zanella Netto
2025-01-30  6:12     ` Florian Weimer
2025-01-30 13:06       ` Adhemerval Zanella Netto
2025-01-30 13:33         ` Florian Weimer
2025-01-30 15:19           ` Andreas Schwab
2025-01-30 16:26           ` Adhemerval Zanella Netto
2025-01-30 16:59             ` Andreas K. Huettel
2025-01-30 16:50     ` Andreas K. Huettel
2025-01-22 16:12 ` [PATCH 2/4] Makefile: Add ld.so.conf with libgcc dir to testroot.pristine dilfridge
2025-01-22 16:12 ` [PATCH 3/4] support: Always run ldconfig in containered tests dilfridge
2025-01-22 16:12 ` [PATCH 4/4] elf: Remove now pointless empty ld.so.conf files in single tests dilfridge
2025-01-22 16:56 ` [RFC] Make containerized tests more robust (libgcc_s.so.1 not found) Andreas Schwab
2025-01-22 17:58   ` Andreas K. Huettel
2025-01-30  1:12     ` Xi Ruoyao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250122161338.141291-2-dilfridge@gentoo.org \
    --to=dilfridge@gentoo.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).