1
0

crt1.s 925 B

12345678910111213141516171819202122232425262728
  1. .set noreorder
  2. .weak _init
  3. .weak _fini
  4. .global __start
  5. .global _start
  6. .type __start,@function
  7. .type _start,@function
  8. __start:
  9. _start:
  10. subu $fp, $fp, $fp # Zero the frame pointer.
  11. lui $gp, %hi(_gp)
  12. addi $gp, %lo(_gp)
  13. #la $gp, _gp
  14. lw $4, %call16(main)($gp) # Get main() ...
  15. lw $5, ($sp) # Get argc...
  16. addu $6, $sp, 4 # and argv ...
  17. lw $7, %call16(_init)($gp) # and _init() ...
  18. and $sp, $sp, -8 # Align the stack pointer to 8 bytes
  19. addi $sp, $sp, -4*6 # Leave space for arguments 0..3, arg4, and arg5.
  20. lw $12, %call16(_fini)($gp) # and _fini() ...
  21. sw $12, 4*4($sp) # Save arg4.
  22. sw $0, 4*5($sp) # ldso_fini == NULL
  23. lw $25, %call16(__libc_start_main)($gp)
  24. jalr $25 # Let's go!
  25. nop
  26. b . # Never gets here.
  27. nop