ifunc-textrel-2.s 398 B

12345678910111213141516171819202122232425262728
  1. .text
  2. .type selector, %function
  3. foo:
  4. movl $0, %eax
  5. ret
  6. selector:
  7. .ifdef __x86_64__
  8. leaq foo(%rip), %rax
  9. .else
  10. leal foo@GOTOFF(%eax), %eax
  11. .endif
  12. ret
  13. .type selector, %gnu_indirect_function
  14. .globl _start
  15. _start:
  16. .ifdef __x86_64__
  17. movabs ptr, %rax
  18. call *%rax
  19. .else
  20. mov ptr, %eax
  21. call *%eax
  22. .endif
  23. ret
  24. .data
  25. .type ptr, @object
  26. ptr:
  27. .dc.a foo
  28. .section .note.GNU-stack,"",@progbits