diff mbox series

Adjust name-prefix of ld.so in test-container.c.

Message ID 0a6087d9-08a2-d157-163f-25697e9e35e2@linux.ibm.com
State New
Headers show
Series Adjust name-prefix of ld.so in test-container.c. | expand

Commit Message

Stefan Liebler Sept. 3, 2018, 8:39 a.m. UTC
Hi,

the test-container.c file assumes that ld.so is always named something 
like /elf/ld-linux-*. But e.g. on s390x it is named ld64.so.1 or ld.so.1 
on s390. There are other architectures like power or mips with similar 
names.

This patch just changes the assumption to /elf/ld*. Without this patch, 
test-container.c is searching invalid files / directories and fails to 
find glibc/nss/tst-nss-test3.root/tst-nss-test3.script. Then the test 
tst-nss-test3 fails!

Bye
Stefan

ChangeLog:

	* support/test-container.c (main): Just search for /elf/ld
	as ld.so in not names ld-linux* on all architectures.

Comments

Florian Weimer Sept. 3, 2018, 10:48 a.m. UTC | #1
On 09/03/2018 10:39 AM, Stefan Liebler wrote:
> the test-container.c file assumes that ld.so is always named something 
> like /elf/ld-linux-*. But e.g. on s390x it is named ld64.so.1 or ld.so.1 
> on s390. There are other architectures like power or mips with similar 
> names.

Perhaps we should capture $(ld.so-version) in support/, like we do for 
$(objpfx), $(prefix), $(libdir) etc.?

Thanks,
Florian
Stefan Liebler Sept. 3, 2018, 2:13 p.m. UTC | #2
On 09/03/2018 12:48 PM, Florian Weimer wrote:
> On 09/03/2018 10:39 AM, Stefan Liebler wrote:
>> the test-container.c file assumes that ld.so is always named something 
>> like /elf/ld-linux-*. But e.g. on s390x it is named ld64.so.1 or 
>> ld.so.1 on s390. There are other architectures like power or mips with 
>> similar names.
> 
> Perhaps we should capture $(ld.so-version) in support/, like we do for 
> $(objpfx), $(prefix), $(libdir) etc.?
> 
> Thanks,
> Florian
> 
Okay. This is possible.
What about the attached patch?
The absolute path of the ld.so is now available via support_objdir_elf_ldso.

Bye
Stefan
commit 42dc9413d3fe3949603839b977bc8f9160950092
Author: Stefan Liebler <stli@linux.ibm.com>
Date:   Fri Aug 31 14:44:23 2018 +0200

    Adjust name of ld.so in test-container.c.
    
    The test-container.c file assumes that ld.so is always named
    something like /elf/ld-linux-*.
    But e.g. on s390x it is named ld64.so.1 or ld.so.1 on s390.
    There are other architectures like power or mips with similar names.
    
    This patch introduces the new global variable support_objdir_elf_ldso
    which contains the absolute path to the runtime linker used by the
    testsuite, e.g. OBJDIR_PATH/elf/ld-linux-x86-64.so.2.
    The check in test-container.c is now comparing against this path.
    Without this patch, test-container.c is searching invalid files / directories
    and fails to find glibc/nss/tst-nss-test3.root/tst-nss-test3.script.
    Then the test tst-nss-test3 fails!
    
    ChangeLog:
    
            * support/support.h (support_objdir_elf_ldso): New variable.
            * support/support_paths.c (support_objdir_elf_ldso): Likewise.
            * support/Makefile (CFLAGS-support_paths.c): Add definition
            for OBJDIR_ELF_LDSO_PATH.
            * support/test-container.c (main): Search for the ld.so
            which is also used by the testsuite.

diff --git a/support/Makefile b/support/Makefile
index b528f538a6..72c49bc7fa 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -158,6 +158,7 @@ endif
 CFLAGS-support_paths.c = \
 		-DSRCDIR_PATH=\"`cd .. ; pwd`\" \
 		-DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \
+		-DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \
 		-DINSTDIR_PATH=\"$(prefix)\" \
 		-DLIBDIR_PATH=\"$(libdir)\"
 
diff --git a/support/support.h b/support/support.h
index c6ff4bafb4..2f51cc81fe 100644
--- a/support/support.h
+++ b/support/support.h
@@ -89,6 +89,10 @@ char *xstrndup (const char *, size_t);
 extern const char support_srcdir_root[];
 extern const char support_objdir_root[];
 
+/* Corresponds to the path to the runtime linker used by the testsuite,
+   e.g. OBJDIR_PATH/elf/ld-linux-x86-64.so.2  */
+extern const char support_objdir_elf_ldso[];
+
 /* Corresponds to the --prefix= passed to configure.  */
 extern const char support_install_prefix[];
 /* Corresponds to the install's lib/ or lib64/ directory.  */
diff --git a/support/support_paths.c b/support/support_paths.c
index a1c22315bd..6d0beb102c 100644
--- a/support/support_paths.c
+++ b/support/support_paths.c
@@ -36,6 +36,14 @@ const char support_objdir_root[] = OBJDIR_PATH;
 # error please -DOBJDIR_PATH=something in the Makefile
 #endif
 
+#ifdef OBJDIR_ELF_LDSO_PATH
+/* Corresponds to the path to the runtime linker used by the testsuite,
+   e.g. OBJDIR_PATH/elf/ld-linux-x86-64.so.2  */
+const char support_objdir_elf_ldso[] = OBJDIR_ELF_LDSO_PATH;
+#else
+# error please -DOBJDIR_ELF_LDSO_PATH=something in the Makefile
+#endif
+
 #ifdef INSTDIR_PATH
 /* Corresponds to the --prefix= passed to configure.  */
 const char support_install_prefix[] = INSTDIR_PATH;
diff --git a/support/test-container.c b/support/test-container.c
index 2e91bdf9ec..e6d659b784 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -675,8 +675,8 @@ main (int argc, char **argv)
 	}
     }
 
-  if (strncmp (argv[1], concat (support_objdir_root, "/elf/ld-linux-", NULL),
-	       strlen (support_objdir_root) + 14) == 0)
+  if (strncmp (argv[1], support_objdir_elf_ldso,
+	       strlen (support_objdir_elf_ldso)) == 0)
     {
       ++argv;
       --argc;
diff mbox series

Patch

commit 875af26b6e3a1ffd8bccc35e4a596853232bfb3c
Author: Stefan Liebler <stli@linux.ibm.com>
Date:   Fri Aug 31 14:44:23 2018 +0200

    Adjust name-prefix of ld.so in test-container.c.
    
    The test-container.c file assumes that ld.so is always named
    something like /elf/ld-linux-*.
    But e.g. on s390x it is named ld64.so.1 or ld.so.1 on s390.
    There are other architectures like power or mips with similar names.
    
    This patch just changes the assumption to /elf/ld*.
    Without this patch, test-container.c is searching invalid files / directories
    and fails to find glibc/nss/tst-nss-test3.root/tst-nss-test3.script.
    Then the test tst-nss-test3 fails!
    
    ChangeLog:
    
            * support/test-container.c (main): Just search for /elf/ld
            as ld.so in not names ld-linux* on all architectures.

diff --git a/support/test-container.c b/support/test-container.c
index 2e91bdf9ec..8f7c3b076b 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -675,8 +675,8 @@  main (int argc, char **argv)
 	}
     }
 
-  if (strncmp (argv[1], concat (support_objdir_root, "/elf/ld-linux-", NULL),
-	       strlen (support_objdir_root) + 14) == 0)
+  if (strncmp (argv[1], concat (support_objdir_root, "/elf/ld", NULL),
+	       strlen (support_objdir_root) + 7) == 0)
     {
       ++argv;
       --argc;