]> git.ipfire.org Git - thirdparty/glibc.git/blame - elf/ifuncmod5.c
Mention IFUNC for PPC.
[thirdparty/glibc.git] / elf / ifuncmod5.c
CommitLineData
3c30afc8
L
1/* Test STT_GNU_IFUNC symbols without direct function call. */
2
3extern int global;
4
5static int
6one (void)
7{
8 return 1;
9}
10
11static int
12minus_one (void)
13{
14 return -1;
15}
16
17static int
e364e6f1 18zero (void)
3c30afc8
L
19{
20 return 0;
21}
22
23void * foo_ifunc (void) __asm__ ("foo");
24__asm__(".type foo, %gnu_indirect_function");
25
e364e6f1 26void *
3c30afc8
L
27foo_ifunc (void)
28{
29 switch (global)
30 {
31 case 1:
32 return one;
33 case -1:
34 return minus_one;
35 default:
36 return zero;
37 }
38}
39
40void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
41__asm__(".type foo_hidden, %gnu_indirect_function");
42
e364e6f1 43void *
3c30afc8
L
44foo_hidden_ifunc (void)
45{
46 switch (global)
47 {
48 case 1:
49 return minus_one;
50 case -1:
51 return one;
52 default:
53 return zero;
54 }
55}
56
57void * foo_protected_ifunc (void) __asm__ ("foo_protected");
58__asm__(".type foo_protected, %gnu_indirect_function");
59
e364e6f1 60void *
3c30afc8
L
61foo_protected_ifunc (void)
62{
63 switch (global)
64 {
65 case 1:
66 return one;
67 case -1:
68 return zero;
69 default:
70 return minus_one;
71 }
72}
73
74/* Test hidden indirect function. */
75__asm__(".hidden foo_hidden");
76
77/* Test protected indirect function. */
78__asm__(".protected foo_protected");