|
Packit Service |
82fcde |
#include <dlfcn.h>
|
|
Packit Service |
82fcde |
#include <stdio.h>
|
|
Packit Service |
82fcde |
#include <string.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static int
|
|
Packit Service |
82fcde |
do_test (void)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
Dl_info i;
|
|
Packit Service |
82fcde |
if (dladdr (&printf, &i) == 0)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
puts ("not found");
|
|
Packit Service |
82fcde |
return 1;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
printf ("found symbol %s in %s\n", i.dli_sname, i.dli_fname);
|
|
Packit Service |
82fcde |
return i.dli_sname == NULL
|
|
Packit Service |
82fcde |
|| (strcmp (i.dli_sname, "printf") != 0
|
|
Packit Service |
82fcde |
/* On architectures which create PIC code by default
|
|
Packit Service |
82fcde |
&printf may resolve to an address in libc.so
|
|
Packit Service |
82fcde |
rather than in the binary. printf and _IO_printf
|
|
Packit Service |
82fcde |
are aliased and which one comes first in the
|
|
Packit Service |
82fcde |
hash table is up to the linker. */
|
|
Packit Service |
82fcde |
&& strcmp (i.dli_sname, "_IO_printf") != 0);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <support/test-driver.c>
|