resolve.S 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #if 0
  2. #include <sysdep.h>
  3. #endif
  4. /*
  5. * These are various helper routines that are needed to run an ELF image.
  6. */
  7. #ifndef ALIGN
  8. #define ALIGN 4
  9. #endif
  10. #ifndef NO_UNDERSCORE
  11. #define RUN _linux_run
  12. #define RESOLVE __dl_linux_resolve
  13. #define EXIT __interpreter_exit
  14. #define RESOLVER __dl_linux_resolver
  15. #define INIT ___loader_bootstrap
  16. #else
  17. #define RUN linux_run
  18. #define RESOLVE _dl_linux_resolve
  19. #define RESOLVER _dl_linux_resolver
  20. #define EXIT _interpreter_exit
  21. #define INIT __loader_bootstrap
  22. #endif
  23. .text
  24. .align ALIGN
  25. .align 16
  26. .globl RESOLVE
  27. .type RESOLVE,@function
  28. RESOLVE:
  29. pusha /* preserve all regs */
  30. lea 0x20(%esp),%eax /* eax = tpnt and reloc_entry params */
  31. pushl 4(%eax) /* push copy of reloc_entry param */
  32. pushl (%eax) /* push copy of tpnt param */
  33. pushl %eax /* _dl_linux_resolver expects a dummy
  34. * param - this could be removed */
  35. #ifdef __PIC__
  36. call .L24
  37. .L24:
  38. popl %ebx
  39. addl $_GLOBAL_OFFSET_TABLE_+[.-.L24],%ebx
  40. movl RESOLVER@GOT(%ebx),%ebx /* eax = resolved func */
  41. call *%ebx
  42. #else
  43. call RESOLVER
  44. #endif
  45. movl %eax,0x2C(%esp) /* store func addr over original
  46. * tpnt param */
  47. addl $0xC,%esp /* remove copy parameters */
  48. popa /* restore regs */
  49. ret $4 /* jump to func removing original
  50. * reloc_entry param from stack */
  51. .LFE2:
  52. .size RESOLVE,.LFE2-RESOLVE