1 /* Test STT_GNU_IFUNC symbols:
3 1. Direct function call.
10 /* Can't use __attribute__((visibility("protected"))) until the GCC bug:
12 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248
15 asm (".protected global");
35 void * foo_ifunc (void) __asm__ ("foo");
36 __asm__(".type foo, %gnu_indirect_function");
39 inhibit_stack_protector
42 return ifunc_sel (one
, minus_one
, zero
);
45 void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
46 __asm__(".type foo_hidden, %gnu_indirect_function");
49 inhibit_stack_protector
50 foo_hidden_ifunc (void)
52 return ifunc_sel (minus_one
, one
, zero
);
55 void * foo_protected_ifunc (void) __asm__ ("foo_protected");
56 __asm__(".type foo_protected, %gnu_indirect_function");
59 inhibit_stack_protector
60 foo_protected_ifunc (void)
62 return ifunc_sel (one
, zero
, minus_one
);
65 /* Test hidden indirect function. */
66 __asm__(".hidden foo_hidden");
68 /* Test protected indirect function. */
69 __asm__(".protected foo_protected");
71 extern int foo (void);
72 extern int foo_hidden (void);
73 extern int foo_protected (void);
75 extern int ret_foo_hidden
;
76 extern int ret_foo_protected
;
79 typedef int (*foo_p
) (void);
89 get_foo_hidden_p (void)
91 ret_foo_hidden
= foo_hidden ();
96 get_foo_protected_p (void)
98 ret_foo_protected
= foo_protected ();