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