resolve.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Xtensa dynamic resolver.
  2. Parts copied from glibc/sysdeps/xtensa/dl-trampoline.S
  3. Copyright (C) 2007 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <http://www.gnu.org/licenses/>. */
  16. #define MIN_FRAME_SIZE 32
  17. #ifdef __XTENSA_EB__
  18. #define XTENSA_IMM12_FLD_OFFSET 8
  19. #else /* __XTENSA_EL__ */
  20. #define XTENSA_IMM12_FLD_OFFSET 12
  21. #endif /* __XTENSA_EL__ */
  22. .text
  23. .align 4
  24. .literal_position
  25. .global _dl_linux_resolve
  26. .type _dl_linux_resolve, @function
  27. _dl_linux_resolve:
  28. /* Call the fixup function. */
  29. movi a8, _dl_linux_resolver
  30. callx8 a8
  31. /* Extract the target's frame size from the ENTRY instruction. */
  32. l32i a11, a10, 0
  33. extui a11, a11, XTENSA_IMM12_FLD_OFFSET, 12
  34. slli a11, a11, 3
  35. addi a11, a11, -MIN_FRAME_SIZE
  36. sub a11, sp, a11
  37. movsp sp, a11
  38. /* Jump to the next instruction past the ENTRY. */
  39. addi a10, a10, 3
  40. jx a10
  41. .size _dl_linux_resolve, . - _dl_linux_resolve