resolve.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com)
  3. *
  4. * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
  5. */
  6. #include <asm.h>
  7. #include <sysdep.h>
  8. #include <sys/syscall.h>
  9. ; Save the registers which resolver could possibly clobber
  10. ; r0-r9: args to the function - symbol being resolved
  11. ; r10-r12 are already clobbered by PLTn, PLT0 thus neednot be saved
  12. .macro SAVE_CALLER_SAVED
  13. PUSHR_S r0
  14. PUSHR_S r1
  15. PUSHR_S r2
  16. PUSHR_S r3
  17. PUSHR r4
  18. PUSHR r5
  19. PUSHR r6
  20. PUSHR r7
  21. PUSHR r8
  22. PUSHR r9
  23. PUSHR_S blink
  24. .endm
  25. .macro RESTORE_CALLER_SAVED_BUT_R0
  26. POPR blink
  27. POPR r9
  28. POPR r8
  29. POPR r7
  30. POPR r6
  31. POPR r5
  32. POPR r4
  33. POPR_S r3
  34. POPR_S r2
  35. POPR_S r1
  36. .endm
  37. ; Upon entry, PLTn, which led us here, sets up the following regs
  38. ; r11 = Module info (tpnt pointer as expected by resolver)
  39. ; r12 = PC of the PLTn itself - needed by resolver to find
  40. ; corresponding .rela.plt entry
  41. ENTRY(_dl_linux_resolve)
  42. ; args to func being resolved, which resolver might clobber
  43. SAVE_CALLER_SAVED
  44. mov_s r1, r12
  45. bl.d _dl_linux_resolver
  46. mov r0, r11
  47. RESTORE_CALLER_SAVED_BUT_R0
  48. j_s.d [r0] ; r0 has resolved function addr
  49. POPR_S r0 ; restore first arg to resolved call
  50. END(_dl_linux_resolve)