crti.S 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. .file "initfini.c"
  2. .section .init
  3. .global _init
  4. .type _init, %function
  5. #if defined __thumb__
  6. .align 1
  7. .thumb
  8. .thumb_func
  9. _init:
  10. push {r4-r7, lr}
  11. #else
  12. .align 2
  13. .arm
  14. _init:
  15. @ gcc 3.3.2 didn't create a stack frame, gcc 3.4.4 does -
  16. @ presumably 3.4.4 can put stuff into .init which requires
  17. @ the arguments to be saved. This code is copied from 3.4.4
  18. mov ip, sp
  19. stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
  20. sub fp, ip, #4
  21. #endif
  22. .section .fini
  23. .global _fini
  24. .type _fini, %function
  25. #if defined __thumb__
  26. .align 1
  27. .thumb
  28. .thumb_func
  29. _fini:
  30. push {r4-r7, lr}
  31. #else
  32. .align 2
  33. .arm
  34. _fini:
  35. mov ip, sp
  36. stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc}
  37. sub fp, ip, #4
  38. #endif
  39. #if (defined __thumb__ || defined __THUMB_INTERWORK__) && (defined __ARM_ARCH_4T__ || defined __ARM_ARCH_5T__ || defined __ARM_ARCH_5TE__)
  40. @ To support thumb code it is currently necessary to have the _call_via_rX
  41. @ functions exposed to the linker for any program or shared library. PLT
  42. @ references are inadequate - the PLT zaps ip and therefore breaks _call_via_ip
  43. @ (and the compiler does generate this). It is simpler to put all the
  44. @ required code in here - it only amounts to 60 bytes overhead.
  45. @NOTE: it would be better to have the compiler generate this stuff as
  46. @ required...
  47. .section ".text"
  48. .align 0
  49. .force_thumb
  50. .macro call_via register
  51. .global _call_via_\register
  52. .type _call_via_\register, %function
  53. .weak _call_via_\register
  54. .hidden _call_via_\register
  55. .thumb_func
  56. _call_via_\register:
  57. bx \register
  58. nop
  59. .size _call_via_\register, . - _call_via_\register
  60. .endm
  61. @ and calls for the 15 general purpose registers (2 bytes each).
  62. call_via r0
  63. call_via r1
  64. call_via r2
  65. call_via r3
  66. call_via r4
  67. call_via r5
  68. call_via r6
  69. call_via r7
  70. call_via r8
  71. call_via r9
  72. call_via sl
  73. call_via fp
  74. call_via ip
  75. call_via sp
  76. call_via lr
  77. #endif
  78. .ident "GCC: (GNU) 3.3.2 20031005 (Debian prerelease)"