main-linux-x86-gas.s 532 B

12345678910111213141516171819202122232425262728
  1. .section .rodata
  2. .align 4
  3. .LC0:
  4. .string "hello assembler world, %d arguments given\n"
  5. .text
  6. .globl main
  7. .type main, @function
  8. main:
  9. leal 4(%esp), %ecx
  10. andl $-16, %esp
  11. pushl -4(%ecx)
  12. pushl %ebp
  13. movl %esp, %ebp
  14. pushl %ecx
  15. subl $20, %esp
  16. movl (%ecx), %eax
  17. movl %eax, 4(%esp)
  18. movl $.LC0, (%esp)
  19. call printf
  20. movl $0, %eax
  21. addl $20, %esp
  22. popl %ecx
  23. popl %ebp
  24. leal -4(%ecx), %esp
  25. ret
  26. .size main, .-main
  27. .ident "GCC: (GNU) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)"
  28. .section .note.GNU-stack,"",@progbits