[13/14] dlfcn: Eliminate GLIBC_PRIVATE dependency from tststatic2

Message ID 4099ccd0d163c2064cb126632bfa2933732592d6.1621446837.git.fweimer@redhat.com
State Superseded
Headers
Series Move libdl into libc |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Florian Weimer May 19, 2021, 6:05 p.m. UTC
  The test appears to use _dlfcn_hook@@GLIBC_PRIVATE as a way to
test dlvsym without having to know the appropriate symbol version.
With <first-versions.h>, we can use a public symbol and the symbol
version at which it was defined first.
---
 dlfcn/modstatic2.c | 3 ++-
 dlfcn/tststatic2.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
  

Patch

diff --git a/dlfcn/modstatic2.c b/dlfcn/modstatic2.c
index 9b5aae8b9f..34568d4e6e 100644
--- a/dlfcn/modstatic2.c
+++ b/dlfcn/modstatic2.c
@@ -4,6 +4,7 @@ 
 #include <stdlib.h>
 #include <string.h>
 #include <gnu/lib-names.h>
+#include <first-versions.h>
 
 int test (FILE *out, int a);
 
@@ -117,7 +118,7 @@  test (FILE *out, int a)
       exit (1);
     }
 
-  if (dlvsym (handle2, "_dlfcn_hook", "GLIBC_PRIVATE") == NULL)
+  if (dlvsym (handle2, "malloc", FIRST_VERSION_libc_malloc_STRING) == NULL)
     {
       fprintf (out, "dlvsym: %s\n", dlerror ());
       exit (1);
diff --git a/dlfcn/tststatic2.c b/dlfcn/tststatic2.c
index f8cd5a964b..ba4648e521 100644
--- a/dlfcn/tststatic2.c
+++ b/dlfcn/tststatic2.c
@@ -4,6 +4,7 @@ 
 #include <stdlib.h>
 #include <string.h>
 #include <gnu/lib-names.h>
+#include <first-versions.h>
 
 static int
 do_test (void)
@@ -115,7 +116,7 @@  do_test (void)
       exit (1);
     }
 
-  if (dlvsym (handle2, "_dlfcn_hook", "GLIBC_PRIVATE") == NULL)
+  if (dlvsym (handle2, "malloc", FIRST_VERSION_libc_malloc_STRING) == NULL)
     {
       printf ("dlvsym: %s\n", dlerror ());
       exit (1);