开发者

What does object file look like

开发者 https://www.devze.com 2023-03-27 02:25 出处:网络
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.

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:

What does object file look like


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 : )

0

精彩评论

暂无评论...
验证码 换一张
取 消