1 /* Test 3 STT_GNU_IFUNC symbols.  */
2 
3 #include "ifunc-sel.h"
4 
5 int global __attribute__ ((visibility ("hidden"))) = -1;
6 
7 static int
one(void)8 one (void)
9 {
10   return 1;
11 }
12 
13 static int
minus_one(void)14 minus_one (void)
15 {
16   return -1;
17 }
18 
19 static int
zero(void)20 zero (void)
21 {
22   return 0;
23 }
24 
25 void * foo1_ifunc (void) __asm__ ("foo1");
26 __asm__(".type foo1, %gnu_indirect_function");
27 
28 void *
foo1_ifunc(void)29 foo1_ifunc (void)
30 {
31   return ifunc_sel (one, minus_one, zero);
32 }
33 
34 void * foo2_ifunc (void) __asm__ ("foo2");
35 __asm__(".type foo2, %gnu_indirect_function");
36 
37 void *
foo2_ifunc(void)38 foo2_ifunc (void)
39 {
40   return ifunc_sel (minus_one, one, zero);
41 }
42 
43 void * foo3_ifunc (void) __asm__ ("foo3");
44 __asm__(".type foo3, %gnu_indirect_function");
45 
46 void *
foo3_ifunc(void)47 foo3_ifunc (void)
48 {
49   return ifunc_sel (one, zero, minus_one);
50 }
51