resolve.S 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2016 Andes Technology, Inc.
  3. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  4. */
  5. .text
  6. .align 4 ! 16 byte boundary
  7. .globl _dl_linux_resolve
  8. .type _dl_linux_resolve,#function
  9. .pic
  10. _dl_linux_resolve:
  11. ! we get called with
  12. ! lp contains the return address from this call
  13. ! r16 contains offset to target reloc entry
  14. ! r17 contains GOT[1] (identity of taget lib)
  15. ! ta is GOT[2] (starting address of this function)
  16. ! save arguments r0 - r5 and gp, lp
  17. smw.adm $r0, [$sp], $r5, 6
  18. ! init gp
  19. mfusr $ta, $PC
  20. sethi $gp, HI20(_GLOBAL_OFFSET_TABLE_+4)
  21. ori $gp, $gp, LO12(_GLOBAL_OFFSET_TABLE_+8)
  22. add $gp, $ta, $gp
  23. ! set arguments
  24. addi $r0, $r17, 0
  25. !addi $r1, $r16, 0
  26. slli $r1, $r16, 2
  27. slli $r16, $r16, 3
  28. add $r1, $r1, $r16
  29. ! comment out profiling argument
  30. !addi $r2, $lp, 0
  31. ! call fixup routine
  32. bal _dl_linux_resolver@PLT
  33. ! save the return
  34. addi $ta, $r0, 0
  35. ! reload registers
  36. lmw.bim $r0, [$sp], $r5, 6
  37. ! jump to the newly found address
  38. jr $ta
  39. .size _dl_linux_resolve, .-_dl_linux_resolve