Fix test isolation for elf/tst-ifunc-fault-lazy, elf/tst-ifunc-fault-bindnow

Message ID 87pngkwfh9.fsf@oldenburg2.str.redhat.com
State Superseded
Headers

Commit Message

Florian Weimer Dec. 19, 2019, 2:35 p.m. UTC
  Previously, ld.so was invoked only with the elf subdirectory on the
library search path.  Since the soname link for libc.so only exists in
the top-level build directory, this leaked the system libc into the
test.

-----
 elf/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Comments

Andreas Schwab Dec. 19, 2019, 2:47 p.m. UTC | #1
On Dez 19 2019, Florian Weimer wrote:

> diff --git a/elf/Makefile b/elf/Makefile
> index 72a5aa88b1..2c52e8ae19 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -1374,11 +1374,13 @@ $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
>  
>  LDFLAGS-tst-ifunc-fault-lazy = -Wl,-z,lazy
>  LDFLAGS-tst-ifunc-fault-bindnow = -Wl,-z,now
> +tst-ifunc-fault-script-ldso = \
> +  $(objpfx)ld.so --library-path $(common-objpfx):$(objpfx)

How about using rtld-prefix?

Andreas.
  

Patch

diff --git a/elf/Makefile b/elf/Makefile
index 72a5aa88b1..2c52e8ae19 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1374,11 +1374,13 @@  $(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
 
 LDFLAGS-tst-ifunc-fault-lazy = -Wl,-z,lazy
 LDFLAGS-tst-ifunc-fault-bindnow = -Wl,-z,now
+tst-ifunc-fault-script-ldso = \
+  $(objpfx)ld.so --library-path $(common-objpfx):$(objpfx)
 define tst-ifunc-fault-script
-( $(objpfx)ld.so --verify --library-path  $(objpfx) $^ \
-  && LD_TRACE_LOADED_OBJECTS=1 $(objpfx)ld.so --library-path $(objpfx) $^ \
+( $(tst-ifunc-fault-script-ldso) --verify $^ \
+  && LD_TRACE_LOADED_OBJECTS=1 $(tst-ifunc-fault-script-ldso) $^ \
   && LD_TRACE_LOADED_OBJECTS=1 LD_DEBUG=unused \
-    $(objpfx)ld.so --library-path  $(objpfx) $^ \
+    $(tst-ifunc-fault-script-ldso) $^ \
 ) > $@; $(evaluate-test)
 endef
 $(objpfx)tst-ifunc-fault-lazy.out: $(objpfx)tst-ifunc-fault-lazy $(objpfx)ld.so