我试图编译一个非常简单的C程序并将其转换为汇编语言。
我正在使用Ubuntu,操作系统类型为64位。
这是C程序。
void add();
int main() {
add();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果我使用gcc -S -m32 -fno-asynchronous-unwind-tables -o simple.S simple.c,这就是我的汇编源代码文件的外观:
.file "main1.c"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
call add
movl $0, %eax
movl %ebp, %esp
popl %ebp
ret
.size main, .-main
.ident "GCC: (Debian 4.4.5-8) 4.4.5" // this part should say Ubuntu instead of Debian
.section .note.GNU-stack,"",@progbits
Run Code Online (Sandbox Code Playgroud)
但是它看起来像这样:
.file "main0.c"
.text
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl …Run Code Online (Sandbox Code Playgroud)