工具接口標準(TIS)可執行鏈接格式(ELF)規範-卷I-字符串表(String Table)

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

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


String Table
字符串表

This section describes the default string table. String table sections hold null-terminated character sequences, commonly called strings. The object file uses these strings to represent symbol and section names. One references a string as an index into the string table section. The first byte, which is index zero, is defined to hold a null character. Likewise, a string table's last byte is defined to hold a null character, ensuring null termination for all strings. A string whose index is zero specifies either no name or a null name, depending on the context. An empty string table section is permitted; its section header's sh_size member would contain zero. Non-zero indexes are invalid for an empty string table.
本分節描述默認的字符串表。字符串表分節包含一終結符結束的字符序列,通常被稱爲字符串。對象文件使用這些字符串來表示符號和分節名。對字符串的引用通過索引來定位到字符串表節中。索引爲0的第一個字節被定義爲終結符。同樣,字符串表的最後一個字節也被定義爲終結符,確保所有字符串都能夠被終結。索引爲0的字符串表示沒有名字或名字爲空,依賴於內容一個空字符串表分節是被允許的;其分節頭中的sh_size成員爲0。對於空字符串表,非0索引是無效的
A section header's sh_name member holds an index into the section header string table section, as designated by the e_shstrndx member of the ELF header. The following figures show a string table with 25 bytes and the strings associated with various indexes.
一個分節頭的sh_name成員包含一個位於分節頭字符串表分節中的索引,分節頭字符串表分節是ELF頭中e_shstrndx成員指定的分節。接下來的圖表示了一個25字節的字符串表以及關聯了不同索引的字符串。

Index    

+0    

+1    

+2    

+3    

+4    

+5    

+6    

+7    

+8    

+9    

0

\0

n

a

m

e

.

\0

V

a

r

10

i

a

b

l

e

\0

a

b

l

e

20

\0

\0

x

x

\0

 

 

 

 

 



Figure 1-14. String Table Indexes
圖1-14.符號表索引

索引(Index)

字符串(String)

0

none

1

name

7

Variable

11

able

16

able

24

null string



As the example shows, a string table index may refer to any byte in the section. A string may appear more than once; references to substrings may exist; and a single string may be referenced multiple times. Unreferenced strings also are allowed.
就像例子中顯示的,一個字符串表索引可能涉及分節中的任何字節。一個字符串可能不止一次出現;可能存在引用子字符串的情況;以及一個單獨字符串可能被引用多次。未引用的字符串也是被允許的。

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