about summary refs log tree commit diff
path: root/elf/Makefile
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-10-28 15:16:32 -0700
committerH.J. Lu <hjl.tools@gmail.com>2022-10-31 09:00:26 -0700
commitbbff275fb1b16f5b7dd95933bde6e1e496414dbf (patch)
treeb38955e4517cb7014e8594acd66d5fad6c5e0e99 /elf/Makefile
parente96971482de05eff92c1408b694c320cedd2d167 (diff)
downloadglibc-bbff275fb1b16f5b7dd95933bde6e1e496414dbf.tar.gz
glibc-bbff275fb1b16f5b7dd95933bde6e1e496414dbf.tar.xz
glibc-bbff275fb1b16f5b7dd95933bde6e1e496414dbf.zip
elf: Build tst-relr-mod[34]a.so with $(LDFLAGS-rpath-ORIGIN)
When --enable-hardcoded-path-in-tests is used only with DT_RUNPATH,
elf/tst-relr3 and elf/tst-relr4 failed to run.  Their dependency
libraries, tst-relr-mod3a.so and tst-relr-mod4a.so, are failed to
load since DT_RUNPATH on executable doesn't apply to them.  Build
tst-relr-mod3a.so and tst-relr-mod4a.so with $(LDFLAGS-rpath-ORIGIN)
to add DT_RUNPATH for their dependency libraries.
Reviewed-by: Fangrui Song <maskray@google.com>
Diffstat (limited to 'elf/Makefile')
-rw-r--r--elf/Makefile4
1 files changed, 2 insertions, 2 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 86c960cf8a..5f7d222bb1 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -2872,7 +2872,7 @@ $(objpfx)tst-relr-mod3b.so: $(objpfx)tst-relr-mod3b.os
 $(objpfx)tst-relr-mod3a.so: $(objpfx)tst-relr-mod3a.os \
   $(objpfx)tst-relr-mod3b.so
 	$(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
-	$(LDFLAGS-soname-fname) \
+	$(LDFLAGS-soname-fname) $(LDFLAGS-rpath-ORIGIN) \
 	-shared -o $@.new $(filter-out $(map-file),$^)
 	$(call after-link,$@.new)
 	mv -f $@.new $@
@@ -2891,7 +2891,7 @@ $(objpfx)tst-relr-mod4b.so: $(objpfx)tst-relr-mod4b.os
 $(objpfx)tst-relr-mod4a.so: $(objpfx)tst-relr-mod4a.os \
   $(objpfx)tst-relr-mod4b.so
 	$(LINK.o) -nostdlib -nostartfiles -Wl,-z,pack-relative-relocs \
-	$(LDFLAGS-soname-fname) \
+	$(LDFLAGS-soname-fname) $(LDFLAGS-rpath-ORIGIN) \
 	-shared -o $@.new $(filter-out $(map-file),$^)
 	$(call after-link,$@.new)
 	mv -f $@.new $@