#include <stdio.h>
// test.c
int main()
{
int a = 1;
int b = 2;
a = a + b;
}
gcc -g -c test.c
objdump -d test.o
test.o: file format Mach-O 64-bit x86-64
Disassembly of section __TEXT,__text:
_main:
0: 55 pushq %rbp
1: 48 89 e5 movq %rsp, %rbp
4: 31 c0 xorl %eax, %eax
6: c7 45 fc 01 00 00 00 movl $1, -4(%rbp)
d: c7 45 f8 02 00 00 00 movl $2, -8(%rbp)
14: 8b 4d fc movl -4(%rbp), %ecx
17: 03 4d f8 addl -8(%rbp), %ecx
1a: 89 4d fc movl %ecx, -4(%rbp)
1d: 5d popq %rbp
1e: c3 retq
网友评论