1 /* Test STT_GNU_IFUNC symbols without direct function call. */ 2 #include "ifunc-sel.h" 3 4 int global __attribute__ ((visibility ("hidden"))) = -1; 5 6 static int one(void)7one (void) 8 { 9 return 1; 10 } 11 12 static int minus_one(void)13minus_one (void) 14 { 15 return -1; 16 } 17 18 static int zero(void)19zero (void) 20 { 21 return 0; 22 } 23 24 void * foo_ifunc (void) __asm__ ("foo"); 25 __asm__(".type foo, %gnu_indirect_function"); 26 27 void * foo_ifunc(void)28foo_ifunc (void) 29 { 30 return ifunc_sel (one, minus_one, zero); 31 } 32 33 void * foo_hidden_ifunc (void) __asm__ ("foo_hidden"); 34 __asm__(".type foo_hidden, %gnu_indirect_function"); 35 36 void * foo_hidden_ifunc(void)37foo_hidden_ifunc (void) 38 { 39 return ifunc_sel (minus_one, one, zero); 40 } 41 42 void * foo_protected_ifunc (void) __asm__ ("foo_protected"); 43 __asm__(".type foo_protected, %gnu_indirect_function"); 44 45 void * foo_protected_ifunc(void)46foo_protected_ifunc (void) 47 { 48 return ifunc_sel (one, zero, minus_one); 49 } 50 51 /* Test hidden indirect function. */ 52 __asm__(".hidden foo_hidden"); 53 54 /* Test protected indirect function. */ 55 __asm__(".protected foo_protected"); 56