2011-03-24 Eric B. Weddington <eric.weddington@atmel.com>
[binutils.git] / gold / testsuite / ifuncmod5.c
blob9a08e8cf53c471c8f0fc998673cc46a2eccdb399
1 /* Test STT_GNU_IFUNC symbols without direct function call. */
2 #include "ifunc-sel.h"
4 int global __attribute__ ((visibility ("protected"))) = -1;
6 static int
7 one (void)
9 return 1;
12 static int
13 minus_one (void)
15 return -1;
18 static int
19 zero (void)
21 return 0;
24 void * foo_ifunc (void) __asm__ ("foo");
25 __asm__(".type foo, %gnu_indirect_function");
27 void *
28 foo_ifunc (void)
30 return ifunc_sel (one, minus_one, zero);
33 void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
34 __asm__(".type foo_hidden, %gnu_indirect_function");
36 void *
37 foo_hidden_ifunc (void)
39 return ifunc_sel (minus_one, one, zero);
42 void * foo_protected_ifunc (void) __asm__ ("foo_protected");
43 __asm__(".type foo_protected, %gnu_indirect_function");
45 void *
46 foo_protected_ifunc (void)
48 return ifunc_sel (one, zero, minus_one);
51 /* Test hidden indirect function. */
52 __asm__(".hidden foo_hidden");
54 /* Test protected indirect function. */
55 __asm__(".protected foo_protected");