本部分内容了解一下,目前尚未见到谁在用。
S 标志(包含以零结尾的字符串)
文档说明:
“If flags contains the
Sflag then the section contains zero-terminated strings. The size of each character in the string is specified in octets by the entity size,entsize, which defaults to 1, but can be set using the syntax: .section name, “aS”, @progbits, entsize”
flag_specific_arguments 在这里是:entsize(实体大小),指定字符串中每个字符的大小(以字节为单位)
M 标志(可合并段)
文档说明:
“If flags contains the
Mflag then the type argument must be specified as well as an extra argument—entsize—like this: .section name, “aM”, @progbits, entsize”
flag_specific_arguments 在这里是:entsize(实体大小),指定合并段中每个元素的大小
文档进一步解释:
- 对于有
M标志但没有S标志的段,必须包含固定大小的常量 - 链接器可以移除具有相同名称、相同实体大小和相同标志的段中的重复项
entsize必须是一个绝对表达式
o 标志(引用其他段)
文档说明:
“If flags contains the
oflag, then the type argument must be present along with an additional field like this: .section name, “ao”, @type, SymbolName”
flag_specific_arguments 在这里是:
SymbolName:指定该段引用的符号名称- 或者
SectionIndex:段索引(用于测试目的)
G 标志(段组成员)
文档说明:
“If flags contains the
Gsymbol then the type argument must be present along with an additional field like this: .section name, “aG”, @progbits, GroupName[, linkage]”
flag_specific_arguments 在这里是:
GroupName:指定此段所属的段组名称- 可选的
linkage字段可以是:comdat:表示此段的唯一副本应被保留- 或
one_only:comdat的别名
组合标志的参数顺序
文档中还详细说明了当多个标志组合时的参数顺序:
M、S 或 E 与 o 标志组合
“Note: If both one of
M,S, orEandoflags are present, then the type and entry size fields should come first, like this: .section name, “aMo”, @progbits, entsize, SymbolName”
M、S 或 E 与 G 标志组合
“Note: If both one of
M,S, orEandGflags are present then the type and entry size fields should come first, like this: .section name, “aMG”, @progbits, entsize, GroupName[, linkage]”
o 和 G 标志组合
“If both
oflag andGflag are present, then theSymbolNamefield forocomes first, like this: .section name, “aoG”, @type, SymbolName, GroupName[, linkage]”
其他相关说明
? 标志的特殊性
文档提到:
“If flags contains the
?symbol then it may not also contain theGsymbol and theGroupNameorlinkagefields should not be present.”
? 标志表示继承前一段的属性,因此不需要额外的参数。
唯一标识符参数
文档最后提到:
“The optional
unique,IDargument must come last. It assignsIDas a unique section ID to distinguish different sections with the same section name…”
这可以看作是 flag_specific_arguments 的一种特殊形式,用于为同名的段分配唯一ID。
