crt_arch.h 572 B

1234567891011121314151617181920212223242526272829
  1. __asm__(
  2. ".set push\n"
  3. ".set noreorder\n"
  4. ".text \n"
  5. ".global _" START "\n"
  6. ".global " START "\n"
  7. ".type _" START ", @function\n"
  8. ".type " START ", @function\n"
  9. "_" START ":\n"
  10. "" START ":\n"
  11. " bal 1f \n"
  12. " move $fp, $0 \n"
  13. " .gpword . \n"
  14. " .gpword " START "_c \n"
  15. ".weak _DYNAMIC \n"
  16. ".hidden _DYNAMIC \n"
  17. " .gpword _DYNAMIC \n"
  18. "1: lw $gp, 0($ra) \n"
  19. " subu $gp, $ra, $gp \n"
  20. " move $4, $sp \n"
  21. " lw $5, 8($ra) \n"
  22. " addu $5, $5, $gp \n"
  23. " lw $25, 4($ra) \n"
  24. " addu $25, $25, $gp \n"
  25. " and $sp, $sp, -8 \n"
  26. " jalr $25 \n"
  27. " subu $sp, $sp, 16 \n"
  28. ".set pop \n"
  29. );