PR binutils/12467
[binutils.git] / gold / testsuite / ifuncmain5.c
blob9e6c2c162505539635203b23b9cbe1440d84e6b4
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 extern foo_p __attribute__ ((noinline)) get_foo (void);
11 extern foo_p __attribute__ ((noinline)) get_foo_protected (void);
13 foo_p
14 __attribute__ ((noinline))
15 get_foo (void)
17 return foo;
20 foo_p
21 __attribute__ ((noinline))
22 get_foo_protected (void)
24 return foo_protected;
27 int
28 main (void)
30 foo_p p;
32 p = get_foo ();
33 if ((*p) () != -1)
34 abort ();
36 p = get_foo_protected ();
37 if ((*p) () != 0)
38 abort ();
40 return 0;