1.3.3 汇编
接着,GCC使用汇编器对hello.s进行汇编,命令如下:
$gcc –c hello.s –o hello.o
生成的目标文件hello.o,Linux下称之为可重定位目标文件。目标文件无法使用文本编辑器直接查看,但是我们可以使用GCC自带的工具objdump命令分析它的内容,命令格式如下:
$objdump –sd hello.o
输出目标文件的主要段的内容与反汇编代码如下:
hello.o: file format elf32-i386
Contents of section .text:
0000 5589e583 e4f083ec 10b80000 00008904 U...............
0010 24e8fcff ffffb800 000000c9 c3 $............
Contents of section .rodata:
0000 48656c6c 6f20576f 726c6421 00 Hello World!.
Contents of section .comment:
0000 00474343 3a202855 62756e74 752f4c69 .GCC: (Ubuntu/Li
0010 6e61726f 20342e34 2e342d31 34756275 naro 4.4.4-14ubu
0020 6e747535 2920342e 342e3500 ntu5) 4.4.5.
Disassembly of section .text:
00000000 <main>:
0: 55 push