BZ #15536: Fix ulp for 128-bit IBM long double.
[glibc.git] / elf / ifuncmod1.c
blob2b8195ce553dfa66614bf5c0908bb1c301407ea1
1 /* Test STT_GNU_IFUNC symbols:
3 1. Direct function call.
4 2. Function pointer.
5 3. Visibility.
6 */
7 #include "ifunc-sel.h"
9 int global __attribute__ ((visibility ("protected"))) = -1;
11 static int
12 one (void)
14 return 1;
17 static int
18 minus_one (void)
20 return -1;
23 static int
24 zero (void)
26 return 0;
29 void * foo_ifunc (void) __asm__ ("foo");
30 __asm__(".type foo, %gnu_indirect_function");
32 void *
33 foo_ifunc (void)
35 return ifunc_sel (one, minus_one, zero);
38 void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
39 __asm__(".type foo_hidden, %gnu_indirect_function");
41 void *
42 foo_hidden_ifunc (void)
44 return ifunc_sel (minus_one, one, zero);
47 void * foo_protected_ifunc (void) __asm__ ("foo_protected");
48 __asm__(".type foo_protected, %gnu_indirect_function");
50 void *
51 foo_protected_ifunc (void)
53 return ifunc_sel (one, zero, minus_one);
56 /* Test hidden indirect function. */
57 __asm__(".hidden foo_hidden");
59 /* Test protected indirect function. */
60 __asm__(".protected foo_protected");
62 extern int foo (void);
63 extern int foo_hidden (void);
64 extern int foo_protected (void);
65 extern int ret_foo;
66 extern int ret_foo_hidden;
67 extern int ret_foo_protected;
69 #define FOO_P
70 typedef int (*foo_p) (void);
72 foo_p
73 get_foo_p (void)
75 ret_foo = foo ();
76 return foo;
79 foo_p
80 get_foo_hidden_p (void)
82 ret_foo_hidden = foo_hidden ();
83 return foo_hidden;
86 foo_p
87 get_foo_protected_p (void)
89 ret_foo_protected = foo_protected ();
90 return foo_protected;