mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
dlfcn: Eliminate GLIBC_PRIVATE dependency from tststatic2
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. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
6f1c701026
commit
9c76debc98
@ -4,6 +4,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <gnu/lib-names.h>
|
#include <gnu/lib-names.h>
|
||||||
|
#include <first-versions.h>
|
||||||
|
|
||||||
int test (FILE *out, int a);
|
int test (FILE *out, int a);
|
||||||
|
|
||||||
@ -117,11 +118,18 @@ test (FILE *out, int a)
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dlvsym (handle2, "_dlfcn_hook", "GLIBC_PRIVATE") == NULL)
|
/* _exit is very unlikely to receive a second symbol version. */
|
||||||
|
void *exit_ptr = dlvsym (handle2, "_exit", FIRST_VERSION_libc__exit_STRING);
|
||||||
|
if (exit_ptr == NULL)
|
||||||
{
|
{
|
||||||
fprintf (out, "dlvsym: %s\n", dlerror ());
|
fprintf (out, "dlvsym: %s\n", dlerror ());
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
if (exit_ptr != dlsym (handle2, "_exit"))
|
||||||
|
{
|
||||||
|
fprintf (out, "dlvsym for _exit does not match dlsym\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
void *(*dlsymfn) (void *, const char *);
|
void *(*dlsymfn) (void *, const char *);
|
||||||
dlsymfn = dlsym (handle2, "dlsym");
|
dlsymfn = dlsym (handle2, "dlsym");
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <gnu/lib-names.h>
|
#include <gnu/lib-names.h>
|
||||||
|
#include <first-versions.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_test (void)
|
do_test (void)
|
||||||
@ -115,11 +116,18 @@ do_test (void)
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dlvsym (handle2, "_dlfcn_hook", "GLIBC_PRIVATE") == NULL)
|
/* _exit is very unlikely to receive a second symbol version. */
|
||||||
|
void *exit_ptr = dlvsym (handle2, "_exit", FIRST_VERSION_libc__exit_STRING);
|
||||||
|
if (exit_ptr == NULL)
|
||||||
{
|
{
|
||||||
printf ("dlvsym: %s\n", dlerror ());
|
printf ("dlvsym: %s\n", dlerror ());
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
if (exit_ptr != dlsym (handle2, "_exit"))
|
||||||
|
{
|
||||||
|
printf ("dlvsym for _exit does not match dlsym\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
void *(*dlsymfn) (void *, const char *);
|
void *(*dlsymfn) (void *, const char *);
|
||||||
dlsymfn = dlsym (handle2, "dlsym");
|
dlsymfn = dlsym (handle2, "dlsym");
|
||||||
|
Loading…
Reference in New Issue
Block a user