crt0pic.S 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. .text
  2. .align 2
  3. .global __environ
  4. .global _start
  5. .global exit
  6. .global main
  7. .global __libc_init
  8. .global __init_stdio
  9. .global __stdio_close_all
  10. .global _void_void_null_func
  11. .type _start,%function
  12. .type exit,%function
  13. .type main,%function
  14. .type __libc_init,%function
  15. .type __init_stdio,%function
  16. .type __stdio_close_all,%function
  17. .type _void_void_null_func,%function
  18. @ r0 = argc
  19. @ r1 = argv
  20. @ r2 = envp
  21. @ sl = data segment
  22. .text
  23. _start:
  24. @ adjust the data segment base pointer
  25. ldr r3,=__data_start
  26. sub sl,sl,r3
  27. mov r9,sl
  28. ldr r3, .L3
  29. str r2,[r9,r3]
  30. ldr r0,[sp, #0]
  31. ldr r1,[sp, #4]
  32. ldr r2,[sp, #8]
  33. /* Tell libc to initialize whatever it needs */
  34. bl __libc_init
  35. bl __init_stdio
  36. bl main
  37. /* ldr r0,=0 */
  38. bl exit
  39. _void_void_null_func:
  40. nop
  41. .weak __libc_init
  42. __libc_init = _void_void_null_func
  43. .weak __init_stdio
  44. __init_stdio = _void_void_null_func
  45. .weak __stdio_close_all
  46. __stdio_close_all = _void_void_null_func
  47. .align 2
  48. .L3:
  49. .word environ
  50. .data
  51. .align 2
  52. .global __environ
  53. __environ:
  54. .long 0
  55. .weak environ
  56. environ = __environ