]> git.ipfire.org Git - thirdparty/glibc.git/blame - elf/ifuncdep2.c
Fix testing with nss-crypt.
[thirdparty/glibc.git] / elf / ifuncdep2.c
CommitLineData
2f083d75
L
1/* Test 3 STT_GNU_IFUNC symbols. */
2
31c759bf
AM
3#include "ifunc-sel.h"
4
e0ed2fb4
L
5int global = -1;
6/* Can't use __attribute__((visibility("protected"))) until the GCC bug:
7
8 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
9
10 is fixed. */
11asm (".protected global");
2f083d75
L
12
13static int
14one (void)
15{
16 return 1;
17}
18
19static int
20minus_one (void)
21{
22 return -1;
23}
24
25static int
9c84384c 26zero (void)
2f083d75
L
27{
28 return 0;
29}
30
31void * foo1_ifunc (void) __asm__ ("foo1");
32__asm__(".type foo1, %gnu_indirect_function");
33
9c84384c 34void *
de659123 35inhibit_stack_protector
2f083d75
L
36foo1_ifunc (void)
37{
31c759bf 38 return ifunc_sel (one, minus_one, zero);
2f083d75
L
39}
40
41void * foo2_ifunc (void) __asm__ ("foo2");
42__asm__(".type foo2, %gnu_indirect_function");
43
9c84384c 44void *
de659123 45inhibit_stack_protector
2f083d75
L
46foo2_ifunc (void)
47{
31c759bf 48 return ifunc_sel (minus_one, one, zero);
2f083d75
L
49}
50
51void * foo3_ifunc (void) __asm__ ("foo3");
52__asm__(".type foo3, %gnu_indirect_function");
53
9c84384c 54void *
de659123 55inhibit_stack_protector
2f083d75
L
56foo3_ifunc (void)
57{
31c759bf 58 return ifunc_sel (one, zero, minus_one);
2f083d75 59}