Fix BZ #17905
[glibc.git] / elf / ifuncmain5.c
blobf398085cb46719d18950533e3178de578face344
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;
17 foo_p
18 __attribute__ ((noinline))
19 get_foo_protected (void)
21 return foo_protected;
24 int
25 main (void)
27 foo_p p;
29 p = get_foo ();
30 if ((*p) () != -1)
31 abort ();
33 p = get_foo_protected ();
34 if ((*p) () != 0)
35 abort ();
37 return 0;