]>
Commit | Line | Data |
---|---|---|
93b53ca2 UD |
1 | #include <dlfcn.h> |
2 | #include <stdio.h> | |
3 | #include <string.h> | |
4 | ||
5 | static int | |
6 | do_test (void) | |
7 | { | |
8 | Dl_info i; | |
9 | if (dladdr (&printf, &i) == 0) | |
10 | { | |
11 | puts ("not found"); | |
12 | return 1; | |
13 | } | |
14 | printf ("found symbol %s in %s\n", i.dli_sname, i.dli_fname); | |
d0d1811f PM |
15 | if (i.dli_sname == NULL) |
16 | return 1; | |
17 | ||
e2239af3 | 18 | #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 |
d0d1811f PM |
19 | /* On architectures which redirect long double to |
20 | _Float128 (e.g powerpc64le), printf will resolve | |
21 | to __printfieee128 due to header redirects. There | |
22 | is no _IO_printfieee128 alias. */ | |
23 | return strcmp (i.dli_sname, "__printfieee128") != 0; | |
24 | #else | |
b80770b2 UD |
25 | return i.dli_sname == NULL |
26 | || (strcmp (i.dli_sname, "printf") != 0 | |
27 | /* On architectures which create PIC code by default | |
28 | &printf may resolve to an address in libc.so | |
29 | rather than in the binary. printf and _IO_printf | |
30 | are aliased and which one comes first in the | |
31 | hash table is up to the linker. */ | |
32 | && strcmp (i.dli_sname, "_IO_printf") != 0); | |
d0d1811f | 33 | #endif |
93b53ca2 UD |
34 | } |
35 | ||
36fe25fd | 36 | #include <support/test-driver.c> |