[英]What does object file look like
我所知
.c 源代碼進入程序集,然后進入 object 文件,object 文件然后相互鏈接(和庫),我們得到可以從 os 運行的應用程序。
但是 object 文件是什么樣的?
它看起來像.asm 還是更像.exe?
object 文件中的指令是如何存儲的? 作為“mov add call”偽代碼還是機器無意義的代碼? (是問題)
Object 文件有一些符號信息(通常是專有的,編譯器/鏈接器相關的)和准備執行的原始編譯機器代碼。
Linux 和許多其他系統中使用的 ELF(可執行和可鏈接格式)如下所示:
機器碼。 您可以使用gcc -S
獲取匯編和gcc -c
獲取 object 文件。
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.
哦,@hexa 在我登錄時給出了一個更好的答案:)
在 Linux 系統上嘗試objdump命令以顯示有關 object 文件的信息,例如:
objdump -D <filename.o> | more
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.