aarch64: Fix f{max,min}{f} build for GCC 4.9 and 5
[glibc.git] / elf / ifuncmod5.c
blob5a957800e84b1acce6f62b752c621e877885c02f
1 /* Test STT_GNU_IFUNC symbols without direct function call. */
2 #include "ifunc-sel.h"
4 int global = -1;
5 /* Can't use __attribute__((visibility("protected"))) until the GCC bug:
7 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
9 is fixed. */
10 asm (".protected global");
12 static int
13 one (void)
15 return 1;
18 static int
19 minus_one (void)
21 return -1;
24 static int
25 zero (void)
27 return 0;
30 void * foo_ifunc (void) __asm__ ("foo");
31 __asm__(".type foo, %gnu_indirect_function");
33 void *
34 inhibit_stack_protector
35 foo_ifunc (void)
37 return ifunc_sel (one, minus_one, zero);
40 void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
41 __asm__(".type foo_hidden, %gnu_indirect_function");
43 void *
44 inhibit_stack_protector
45 foo_hidden_ifunc (void)
47 return ifunc_sel (minus_one, one, zero);
50 void * foo_protected_ifunc (void) __asm__ ("foo_protected");
51 __asm__(".type foo_protected, %gnu_indirect_function");
53 void *
54 inhibit_stack_protector
55 foo_protected_ifunc (void)
57 return ifunc_sel (one, zero, minus_one);
60 /* Test hidden indirect function. */
61 __asm__(".hidden foo_hidden");
63 /* Test protected indirect function. */
64 __asm__(".protected foo_protected");