crti.s 382 B

123456789101112131415161718192021222324252627
  1. .section .init
  2. .global _init
  3. _init:
  4. push {r0,r1,r2,r4,r5,lr}
  5. .weak __fini_array_start
  6. .weak __fini_array_end
  7. .section .fini
  8. .global _fini
  9. _fini:
  10. push {r4,r5,r6,lr}
  11. adr lr, 1f
  12. ldr r4, 2f
  13. ldr r5, 2f+4
  14. add r4, r4, lr
  15. add r5, r5, lr
  16. 1: adr lr, 1b
  17. cmp r4, r5
  18. beq 3f
  19. ldmia r4!, {r3}
  20. tst r3,#1
  21. moveq pc,r3
  22. bx r3
  23. 2: .word __fini_array_start-1b
  24. .word __fini_array_end-1b
  25. 3: