[PATCH 2/2] elf: Use +nolink-deps to add make-only dependency for tst-origin

Florian Weimer fweimer@redhat.com
Fri Mar 21 18:42:25 GMT 2025


The tst-origin test must link against liborigin-mod.so.  Correct
build order depends on a makefile rule dependency on
$(objpfx)liborigin-mod.so.  Use +nolink-deps to remvoe this
dependency from the linker command line.
---
 elf/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/elf/Makefile b/elf/Makefile
index 3d60000ec9..d13a46a92b 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -3451,8 +3451,11 @@ $(objpfx)tst-dlopen-constructor-null-mod2.so: \
 
 CFLAGS-tst-origin.c += $(no-stack-protector)
 CFLAGS-liborigin-mod.c += $(no-stack-protector)
+# Link tst-origin with liborigin-mod.so, but without a full path.
 LDFLAGS-tst-origin += -Wl,-rpath,\$$ORIGIN -L$(subst :, -L,$(rpath-link)) -lorigin-mod
-$(objpfx)tst-origin.out: tst-origin.sh $(objpfx)liborigin-mod.so $(objpfx)tst-origin
+$(objpfx)tst-origin: +nolink-deps += $(objpfx)liborigin-mod.so
+$(objpfx)tst-origin: $(objpfx)liborigin-mod.so
+$(objpfx)tst-origin.out: tst-origin.sh $(objpfx)tst-origin
 	$(SHELL) \
 		$< \
 		'$(common-objpfx)' \
-- 
2.48.1



More information about the Libc-alpha mailing list