elf: Remove LD_PROFILE for static binaries
[glibc.git] / elf / ifuncmain5.c
blob6fda768fb6908aed552e3150a478ad2c60c06cdf
1 /* Test STT_GNU_IFUNC symbols with dynamic function pointer only. */
3 #include <stdlib.h>
5 extern int foo (void);
6 extern int foo_protected (void);
8 typedef int (*foo_p) (void);
10 foo_p
11 __attribute__ ((noinline))
12 get_foo (void)
14 return foo;
18 /* Address-significant access to protected symbols is not supported in
19 position-dependent mode on several architectures because GCC
20 generates relocations that assume that the address is local to the
21 main program. */
22 #ifdef __PIE__
23 foo_p
24 __attribute__ ((noinline))
25 get_foo_protected (void)
27 return foo_protected;
29 #endif
31 int
32 main (void)
34 foo_p p;
36 p = get_foo ();
37 if ((*p) () != -1)
38 abort ();
40 #ifdef __PIE__
41 p = get_foo_protected ();
42 if ((*p) () != 0)
43 abort ();
44 #endif
46 return 0;