summaryrefslogtreecommitdiff
path: root/Makeconfig
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2025-02-08 17:09:01 +0100
committerAndreas K. Hüttel <dilfridge@gentoo.org>2025-07-09 15:45:46 +0200
commitcf462982ac44bf0f5dfd36a9c242628f0d2970b9 (patch)
tree884565e741e5d5d6bcb342c00135b287bc40c91f /Makeconfig
parent30c7cf66b80f718a819609441ec4f68c9b0b4a9e (diff)
Makeconfig: Add libgcc directory to rtld-prefix search path
* 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 <dilfridge@gentoo.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'Makeconfig')
-rw-r--r--Makeconfig12
1 files changed, 10 insertions, 2 deletions
diff --git a/Makeconfig b/Makeconfig
index 1bb143e950..1f8c912011 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -639,7 +639,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 misc debug
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)
@@ -696,6 +696,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
@@ -713,6 +718,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-file-name=libgcc_s.so$(libgcc_s.so-version) | sed 's#/[^/]*$$##')
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
@@ -785,10 +791,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 = \