1. 程式人生 > >工具介面標準(TIS)可執行連結格式(ELF)規範-卷II-處理器特性(Intel架構) (Processor Specific (Intel Architecture))

工具介面標準(TIS)可執行連結格式(ELF)規範-卷II-處理器特性(Intel架構) (Processor Specific (Intel Architecture))

本文是對Tool Interface Standard (TIS) Executable and Linking Format (ELF) Specification Version 1.2的翻譯
工具介面標準(TIS)可執行連結格式(ELF)規範版本 1.2

翻譯以中英對照方式,英語水品有限,如有翻譯不當的地方,請諒解。

Introduction
介紹

This section describes the Intel Architecture specific information necessary to comply with the ELF object file format. This information is independent of operating system type. Further information on Intel platforms that is both Intel Architecture and operating system dependent, is described in Book III.
此節描述遵守ELF物件檔案格式必要的Inel架構特定資訊。這些資訊不依賴於作業系統型別。Intel平臺上依賴於Intel架構和作業系統的更進一步的資訊在卷III進行描述。
ELF Header
ELF頭


Machine Information
機器資訊

For file identification in e_ident, the Intel architecture requires the following values.
對於e_ident中檔案識別,Intel架構需要以下值

Figure1-1. Intel Identification, e_ident

圖1-1.Intel識別,e_ident

位置(Position)

值(Value)

e_ident[EI_CLASS]

ELFCLASS32

e_ident[EI_DATA]

ELFDATA2LSB



Processor identification resides in the ELF header's e_machine member and must have the value EM_386.
處理器識別位於ELF頭中的成員e_machine,並且必須取值EM_386。
The ELF header's e_flags member holds bit flags associated with the file. The Intel architecture defines no flags; so this member contains zero.
ELF頭的成員e_flags包含關聯檔案的位標誌。Intel架構沒有定義標誌,所以此成員為0。


Relocation
重定位

Relocation Types
重定位型別

Relocation entries describe how to alter the following instruction and data fields (bit numbers appear in the lower box corners).
重定位入口描述如何轉換以下指令和資料欄位(位編號在圖示方框的下角處)
Figure 1-2. Relocatable Fields
圖1-2.重定位欄位

 


word32

This specifies a 32-bit field occupying 4 bytes with arbitrary byte alignment. 

These values use the same byte order as other word values in the Intel architecture.

此處指定了一個佔據任意4位元組對齊的32位欄位。Intel架構下的所有字的值都使用相同的位元組序。




Calculations below assume the actions are transforming a relocatable file into either an executable or a shared object file. Conceptually, the link editor merges one or more relocatable files to form the output. It first decides how to combine and locate the input files, then updates the symbol values, and finally performs the relocation. Relocations applied to executable or shared object files are similar and accomplish the same result. Descriptions below use the following notation.
以下的計算假設轉換一個重定位檔案到一個可執行或者共享物件檔案。概念上講,連結編輯器合併一個或多個重定位檔案來組成輸出。它首先描述如何合併和定位輸入檔案,然後更新符號值,最後執行重定位。重定位應用到可執行或共享檔案時是相似的並且達成相同的結果。後面的描述將使用以下的符號。

A

This means the addend used to compute the value of the relocatable field.

A表示這個加數被用來計算重定位欄位的值。

P

This means the place (section offset or address) of the storage unit being relocated (computed using r_offset).

P表示儲存位置單元的位置(分節偏移或地址)將被重定位(使用r_offset計算)。

S

This means the value of the symbol whose index resides in the relocation entry.

S表示索引位於重定位入口的符號值。



A relocation entry's r_offset value designates the offset or virtual address of the first byte of the affected storage unit. The relocation type specifies which bits to change and how to calculate their values. The Intel architecture uses only Elf32_Rel relocation entries, the field to be relocated holds the addend. In all cases, the addend and the computed result use the same byte order.
重定位入口的r_offset值指定了被影響到的儲存單元的偏移或虛擬地址。重定位型別指明瞭哪些位需要被改變及如何計算它們的值。Intel架構只使用Elf32_Rel重定位入口,被重定位的欄位包含加數。在所有情況下,加數和計算結果使用相同的位元組序。

Figure1-3. Relocation Types

圖1-3.重定位型別

名字(Name)

值(Value)

欄位(Field)

計算(Calculation)

R_386_NONE

0

none

none

R_386_32

1

word32

S+A

R_386_PC32

2

word32

S+A-P



NOTE. Relocation types 3 through 10 are reserved. (See Book III, Appendix A.)
注意:重定位型別3到10是被保留的。(看卷III,附錄A)