Overall Flow gcc compiler program C as shown below
Use the following command:
- .c---> .i
gcc -E hello.c
- .c--->.s
gcc -S hello.c
- .c--->.o
gcc -c hello.c
- .c--->.out
gcc hello.c
- .o disassemble
objdump -d hello.o
The following examples show you by a
First create a hello.c and a hello.h
Then use the first command gcc -E hello.c
The contents of the file preprocessing particularly large, only part of the screenshot.
And then view assembler files gcc -S hello.c
You can see, a .s file has been generated, there's a lot of content is very complex.
Then compiled object file gcc -c hello.c
Because the target file is a binary file, it can not be viewed by a text editor.
After linking an executable file gcc hello.c
You can also view by objdump disassembly tool disassembly objdump -d hello.o
Disassembled code to be more concise and readable than assembler code generated directly (eliminating a lot of redundant information)