crti.S 1.9 KB

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