Add {,sysdep-}ld-library-path make variable
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Fri, 13 Nov 2020 19:37:41 +0000 (19:37 +0000)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 16 Nov 2020 21:15:20 +0000 (21:15 +0000)
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
dlfcn/Makefile
elf/Makefile
inet/Makefile
nptl/Makefile
sysdeps/mach/hurd/Makeconfig

index dfda418..8074613 100644 (file)
@@ -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)$(addprefix :,$(sysdep-ld-library-path))
 
 ifndef LD
 LD := ld -X
index 4b7e038..412e7c5 100644 (file)
@@ -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)
index 2015383..a494b14 100644 (file)
@@ -180,7 +180,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)
 
@@ -1671,7 +1671,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
index 7a807fe..a32c433 100644 (file)
@@ -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)
index f413491..74ab758 100644 (file)
@@ -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)
index fe3b7c5..9adf8f2 100644 (file)
@@ -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