工具接口标准(TIS)可执行链接格式(ELF)规范-卷I-字符串表(String Table)

本文介绍了工具接口标准(TIS)可执行链接格式(ELF)规范版本1.2中的字符串表部分。字符串表用于存储符号和分节的名字,通过索引引用。字符串表必须以null字符结尾,以确保字符串的有效终止。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文是对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.
就像例子中显示的,一个字符串表索引可能涉及分节中的任何字节。一个字符串可能不止一次出现;可能存在引用子字符串的情况;以及一个单独字符串可能被引用多次。未引用的字符串也是被允许的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值