crt0pic.S 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. /* Tell libc to initialize whatever it needs */
  31. bl __libc_init
  32. bl __init_stdio
  33. /* pull argc, argv and envp off the stack */
  34. ldr r0,[sp, #0]
  35. ldr r1,[sp, #4]
  36. ldr r2,[sp, #8]
  37. bl main
  38. /* ldr r0,=0 */
  39. bl exit
  40. _void_void_null_func:
  41. nop
  42. .weak __libc_init
  43. __libc_init = _void_void_null_func
  44. .weak __init_stdio
  45. __init_stdio = _void_void_null_func
  46. .weak __stdio_close_all
  47. __stdio_close_all = _void_void_null_func
  48. .align 2
  49. .L3:
  50. .word environ
  51. .data
  52. .align 2
  53. .global __environ
  54. __environ:
  55. .long 0
  56. .weak environ
  57. environ = __environ