Enable tst-glibc-hwcaps-cache for --enable-hardcoded-path-in-tests

Message ID 20201207145520.745916-1-hjl.tools@gmail.com
State Dropped
Headers
Series Enable tst-glibc-hwcaps-cache for --enable-hardcoded-path-in-tests |

Commit Message

H.J. Lu Dec. 7, 2020, 2:55 p.m. UTC
  RPATH/RUNPATH works with glibc-hwcaps for this test.
---
 sysdeps/x86_64/Makefile | 4 ----
 1 file changed, 4 deletions(-)
  

Comments

Florian Weimer Dec. 7, 2020, 3:43 p.m. UTC | #1
* H. J. Lu via Libc-alpha:

> RPATH/RUNPATH works with glibc-hwcaps for this test.

I find that surprising.  I thought that $(objpfx)/elf would be on the
search path and searched first, so that the detection logic would not
work.

Or isn't $(objpfx)/elf copied into the testroot with all its files?
Cc:ing DJ.

Thanks,
Florian
  
H.J. Lu Dec. 7, 2020, 4:03 p.m. UTC | #2
On Mon, Dec 7, 2020 at 7:43 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> > RPATH/RUNPATH works with glibc-hwcaps for this test.
>
> I find that surprising.  I thought that $(objpfx)/elf would be on the
> search path and searched first, so that the detection logic would not
> work.
>
> Or isn't $(objpfx)/elf copied into the testroot with all its files?

[hjl@gnu-cfl-2 testroot.pristine]$ pwd
/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/testroot.pristine
[hjl@gnu-cfl-2 testroot.pristine]$ find
export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux -type f
export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/elf/ld-linux-x86-64.so.2
export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/math/libm.so.6
export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/libc.so.6
[hjl@gnu-cfl-2 testroot.pristine]$

ld.so, libc.so and libm.so are copied.  Since

[hjl@gnu-cfl-2 build-x86_64-linux]$ readelf -dl elf/tst-glibc-hwcaps-cache

Elf file type is EXEC (Executable file)
Entry point 0x4011d0
There are 13 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000400040 0x0000000000400040
                 0x00000000000002d8 0x00000000000002d8  R      0x8
  INTERP         0x0000000000000318 0x0000000000400318 0x0000000000400318
                 0x0000000000000048 0x0000000000000048  R      0x1
      [Requesting program interpreter:
/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/elf/ld.so]
  LOAD           0x0000000000000000 0x0000000000400000 0x0000000000400000
                 0x0000000000000b28 0x0000000000000b28  R      0x1000
  LOAD           0x0000000000001000 0x0000000000401000 0x0000000000401000
                 0x00000000000006bd 0x00000000000006bd  R E    0x1000
  LOAD           0x0000000000002000 0x0000000000402000 0x0000000000402000
                 0x0000000000000510 0x0000000000000510  R      0x1000
  LOAD           0x0000000000002de8 0x0000000000403de8 0x0000000000403de8
                 0x00000000000002a8 0x00000000000002b8  RW     0x1000
  DYNAMIC        0x0000000000002e00 0x0000000000403e00 0x0000000000403e00
                 0x00000000000001f0 0x00000000000001f0  RW     0x8
  NOTE           0x0000000000000360 0x0000000000400360 0x0000000000400360
                 0x0000000000000030 0x0000000000000030  R      0x8
  NOTE           0x0000000000000390 0x0000000000400390 0x0000000000400390
                 0x0000000000000044 0x0000000000000044  R      0x4
  GNU_PROPERTY   0x0000000000000360 0x0000000000400360 0x0000000000400360
                 0x0000000000000030 0x0000000000000030  R      0x8
  GNU_EH_FRAME   0x0000000000002250 0x0000000000402250 0x0000000000402250
                 0x000000000000007c 0x000000000000007c  R      0x4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10
  GNU_RELRO      0x0000000000002de8 0x0000000000403de8 0x0000000000403de8
                 0x0000000000000218 0x0000000000000218  R      0x1

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.gnu.property .note.gnu.build-id .note.ABI-tag
.hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn
.rela.plt
   03     .init .plt .text .fini
   04     .rodata .eh_frame_hdr .eh_frame
   05     .init_array .fini_array .dynamic .got .got.plt .data .bss
   06     .dynamic
   07     .note.gnu.property
   08     .note.gnu.build-id .note.ABI-tag
   09     .note.gnu.property
   10     .eh_frame_hdr
   11
   12     .init_array .fini_array .dynamic .got

Dynamic section at offset 0x2e00 contains 26 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath:
[/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/math:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/elf:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/dlfcn:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/nss:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/nis:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/rt:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/resolv:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/mathvec:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/support:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/crypt:/export/build/gnu/tools-build/glibc-gitlab/build-x86_64-linux/nptl]

it works fine.

> Cc:ing DJ.
  

Patch

diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index d1d7cb9d2e..7dc04972b8 100644
--- a/sysdeps/x86_64/Makefile
+++ b/sysdeps/x86_64/Makefile
@@ -177,11 +177,7 @@  $(objpfx)glibc-hwcaps/x86-64-v4/libmarkermod4.so: $(objpfx)libmarkermod4-4.so
 	$(make-target-directory)
 	cp $< $@
 
-ifeq (no,$(build-hardcoded-path-in-tests))
-# This is an ld.so.cache test, and RPATH/RUNPATH in the executable
-# interferes with its test objectives.
 tests-container += tst-glibc-hwcaps-cache
-endif
 
 endif # $(subdir) == elf