This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/24506] FAIL: elf/tst-pldd with --enable-hardcoded-path-in-tests


https://sourceware.org/bugzilla/show_bug.cgi?id=24506

--- Comment #11 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
In fact test in container does support --enable-hardcoded-path-in-tests, it
copies the required hardcoded libraries (taking care of replicating the full
path inside testroot.root). The issue is the resulting library names obtained
with pldd will have the 'vanilla' names os 'ld.so' and 'libc.so' instead of the
installed ABI names (ld-linux-x86-64.so.2 for instance on x86_64).

The following patch should fixed it:

---
diff --git a/elf/tst-pldd.c b/elf/tst-pldd.c
index ed19cedd05..0e2243349c 100644
--- a/elf/tst-pldd.c
+++ b/elf/tst-pldd.c
@@ -20,7 +20,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdint.h>
-#include <libgen.h>
 #include <stdbool.h>

 #include <array_length.h>
@@ -39,6 +38,15 @@ target_process (void *arg)
 /* The test runs in a container because pldd does not support tracing
    a binary started by the loader iself (as with testrun.sh).  */

+static bool
+in_string_list (const char *libname, const char *const strlist[])
+{
+  for (const char *const *str = strlist; *str != NULL; str++)
+    if (strcmp (libname, *str) == 0)
+      return true;
+  return false;
+}
+
 static int
 do_test (void)
 {
@@ -89,14 +97,18 @@ do_test (void)
        if (buffer[strlen(buffer)-1] == '\n')
          buffer[strlen(buffer)-1] = '\0';

-       if (strcmp (basename (buffer), LD_SO) == 0)
+       const char *libname = basename (buffer);
+
+       if (in_string_list (libname,
+                           (const char *const []) { "ld.so", LD_SO, NULL }))
          {
            TEST_COMPARE (interpreter_found, false);
            interpreter_found = true;
            continue;
          }

-       if (strcmp (basename (buffer), LIBC_SO) == 0)
+       if (in_string_list (libname,
+                           (const char *const []) { "libc.so", LIBC_SO, NULL
}))
          {
            TEST_COMPARE (libc_found, false);
            libc_found = true;
---

I will send it upstream.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]