What does object file look like
As i know
.c source goes to assembly then it goes to object file, object files then are linking to each other(and to li开发者_如何学Gobraries) and we get application we can run from os. But what does object file look like? Does it look like .asm or more like .exe? How are instructions inside object file stored? As "mov add call" pseudocode or as machine senseless code? (is the question)Object files have some symbol information (usually proprietary, compiler/linker dependent) and the raw compiled machine code ready to be executed.
ELF (Executable and Linkable format) used in Linux and many other systems goes like this:
Try objdump command on Linux system to display information about object files like:
objdump -D <filename.o> | more
Machine code. You can use gcc -S
to get assembly and gcc -c
to get object files.
Object files are machine code for the specific processor targeted by the compiler, along with symbolic information like function names in the case of libraries so that runtime-linked code can find the memory location (within the object file) of executable code.
Ooh @hexa gave a much nicer answer while I was logging in : )
精彩评论