工具接口標準(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)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章