ifuncdep2.c 740 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* Test 3 STT_GNU_IFUNC symbols. */
  2. #include "ifunc-sel.h"
  3. int global __attribute__ ((visibility ("hidden"))) = -1;
  4. static int
  5. one (void)
  6. {
  7. return 1;
  8. }
  9. static int
  10. minus_one (void)
  11. {
  12. return -1;
  13. }
  14. static int
  15. zero (void)
  16. {
  17. return 0;
  18. }
  19. void * foo1_ifunc (void) __asm__ ("foo1");
  20. __asm__(".type foo1, %gnu_indirect_function");
  21. void *
  22. foo1_ifunc (void)
  23. {
  24. return ifunc_sel (one, minus_one, zero);
  25. }
  26. void * foo2_ifunc (void) __asm__ ("foo2");
  27. __asm__(".type foo2, %gnu_indirect_function");
  28. void *
  29. foo2_ifunc (void)
  30. {
  31. return ifunc_sel (minus_one, one, zero);
  32. }
  33. void * foo3_ifunc (void) __asm__ ("foo3");
  34. __asm__(".type foo3, %gnu_indirect_function");
  35. void *
  36. foo3_ifunc (void)
  37. {
  38. return ifunc_sel (one, zero, minus_one);
  39. }