about summary refs log tree commit diff
path: root/elf/Makefile
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-03-15 10:33:43 +0100
committerFlorian Weimer <fweimer@redhat.com>2021-03-16 10:27:53 +0100
commitdd8023c2ac0af28a6e391a2eb5038bb351694243 (patch)
tree5ac1f106866f4b9e01a7a2fe7cf0fbae20227f2a /elf/Makefile
parentea5a537e879bb667e03435a2308d915dc89448a6 (diff)
downloadglibc-dd8023c2ac0af28a6e391a2eb5038bb351694243.tar.gz
glibc-dd8023c2ac0af28a6e391a2eb5038bb351694243.tar.xz
glibc-dd8023c2ac0af28a6e391a2eb5038bb351694243.zip
elf: ld.so --help calls _dl_init_paths without a main map [BZ #27577]
In this case, use the link map of the dynamic loader itself as
a replacement.  This is more than just a hack: if we ever support
DT_RUNPATH/DT_RPATH for the dynamic loader, reporting it for
ld.so --help (without further command line arguments) would be the
right thing to do.

Fixes commit 332421312576bd7095e70589154af99b124dd2d1 ("elf: Always
set l in _dl_init_paths (bug 23462)").

(cherry picked from commit 4e6db99c665d3b82a70a3e218860ef087b1555b4)
Diffstat (limited to 'elf/Makefile')
-rw-r--r--elf/Makefile18
1 files changed, 16 insertions, 2 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 63da0ed64f..4b92f8b305 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -245,7 +245,7 @@ tests += $(tests-execstack-$(have-z-execstack))
 ifeq ($(run-built-tests),yes)
 tests-special += $(objpfx)tst-leaks1-mem.out \
 		 $(objpfx)tst-leaks1-static-mem.out $(objpfx)noload-mem.out \
-		 $(objpfx)tst-ldconfig-X.out
+		 $(objpfx)tst-ldconfig-X.out $(objpfx)tst-rtld-help.out
 endif
 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
@@ -433,7 +433,8 @@ endif
 ifeq (yes,$(build-shared))
 ifeq ($(run-built-tests),yes)
 tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out \
-		 $(objpfx)tst-rtld-preload.out $(objpfx)argv0test.out
+		 $(objpfx)tst-rtld-preload.out $(objpfx)argv0test.out \
+		 $(objpfx)tst-rtld-help.out
 endif
 tests-special += $(objpfx)check-textrel.out $(objpfx)check-execstack.out \
 		 $(objpfx)check-wx-segment.out \
@@ -1908,3 +1909,16 @@ $(objpfx)list-tunables.out: tst-rtld-list-tunables.sh $(objpfx)ld.so
 	$(evaluate-test)
 
 tst-dst-static-ENV = LD_LIBRARY_PATH='$$ORIGIN'
+
+$(objpfx)tst-rtld-help.out: $(objpfx)ld.so
+	$(test-wrapper) $(rtld-prefix) --help > $@; \
+	status=$$?; \
+	echo "info: ld.so exit status: $$status" >> $@; \
+	if ! grep -q 'Legacy HWCAP subdirectories under library search path directories' $@; then \
+	  echo "error: missing subdirectory pattern" >> $@; \
+	  if test $$status -eq 0; then \
+	    status=1; \
+	  fi; \
+	fi; \
+	(exit $$status); \
+	$(evaluate-test)