crti.S 955 B

123456789101112131415161718192021222324252627282930313233343536
  1. .section .init
  2. .balign 4
  3. .global _init
  4. .type _init, @function
  5. _init:
  6. addi sp, sp, -8
  7. /* The code gcc puts between crti and crtn reaches the GOT through r22,
  8. and r22 belongs to the caller here -- ld.so calls _init directly. So
  9. set it up ourselves, as glibc's crti.S does. */
  10. stw r22, 0(sp)
  11. nextpc r22
  12. 1: movhi r8, %hiadj(_gp_got - 1b)
  13. addi r8, r8, %lo(_gp_got - 1b)
  14. add r22, r22, r8
  15. stw ra, 4(sp)
  16. .balign 4
  17. .section .fini
  18. .balign 4
  19. .global _fini
  20. .type _fini, @function
  21. _fini:
  22. addi sp, sp, -8
  23. /* The code gcc puts between crti and crtn reaches the GOT through r22,
  24. and r22 belongs to the caller here -- ld.so calls _init directly. So
  25. set it up ourselves, as glibc's crti.S does. */
  26. stw r22, 0(sp)
  27. nextpc r22
  28. 1: movhi r8, %hiadj(_gp_got - 1b)
  29. addi r8, r8, %lo(_gp_got - 1b)
  30. add r22, r22, r8
  31. stw ra, 4(sp)
  32. .balign 4