resolve.S 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Stolen from glibc-2.2.2 by David Schleef <ds@schleef.org>
  3. */
  4. .text
  5. .align 4
  6. .globl _dl_linux_resolver
  7. .globl _dl_linux_resolve
  8. .type _dl_linux_resolve,@function
  9. _dl_linux_resolve:
  10. /* We need to save the registers used to pass parameters, and register 0,
  11. which is used by _mcount; the registers are saved in a stack frame. */
  12. stwu 1,-64(1)
  13. stw 0,12(1)
  14. stw 3,16(1)
  15. stw 4,20(1)
  16. /* The code that calls this has put parameters for 'fixup' in r12 and r11. */
  17. mr 3,12
  18. stw 5,24(1)
  19. mr 4,11
  20. stw 6,28(1)
  21. mflr 0
  22. /* We also need to save some of the condition register fields. */
  23. stw 7,32(1)
  24. stw 0,48(1)
  25. stw 8,36(1)
  26. mfcr 0
  27. stw 9,40(1)
  28. stw 10,44(1)
  29. stw 0,8(1)
  30. bl _dl_linux_resolver@local
  31. /* 'fixup' returns the address we want to branch to. */
  32. mtctr 3
  33. /* Put the registers back... */
  34. lwz 0,48(1)
  35. lwz 10,44(1)
  36. lwz 9,40(1)
  37. mtlr 0
  38. lwz 8,36(1)
  39. lwz 0,8(1)
  40. lwz 7,32(1)
  41. lwz 6,28(1)
  42. mtcrf 0xFF,0
  43. lwz 5,24(1)
  44. lwz 4,20(1)
  45. lwz 3,16(1)
  46. lwz 0,12(1)
  47. /* ...unwind the stack frame, and jump to the PLT entry we updated. */
  48. addi 1,1,64
  49. bctr
  50. .LFE2:
  51. .size _dl_linux_resolve,.LFE2-_dl_linux_resolve