The section header allows you to locate all of the file sections. An entry in a section header table contains information characterizing the data in a section.
The section header contains the following information:
addr
Address at which the first byte resides if the section appears in the memory image of a process; the default value is 0.
addralign
Aligns the address if a section has an address alignment constraint; for example, if a section contains a double-word, the entire section must be ensured double-word alignment. Only 0 and positive integral powers of 2 are currently allowed. A value of 0 or 1 indicates no address alignment constraints.
entsize
Size in bytes for entries in fixed-size tables such as the symbol table.
flags
One-bit descriptions of section attributes. Table 3–2 describes the section attribute flags.
Flag |
Default Value |
Description |
---|---|---|
SHF_WRITE |
0x1 |
Contains data that is writable during process execution. |
SHF_ALLOC |
0x2 |
Occupies memory during process execution. This attribute is off if a control section does not reside in the memory image of the object file. |
SHF_EXECINSTR |
0x4 |
Contains executable machine instructions. |
SHF_MASKPROC |
0xf0000000 |
Reserved for processor-specific semantics. |
info
Extra information. The interpretation of this information depends on the section type, as described in Table 3–3.
link
Section header table index link. The interpretation of this information depends on the section type, as described in Table 3–3.
name
Specifies the section name. An index into the section header string table section specifies the location of a null-terminated string.
offset
Specifies the byte offset from the beginning of the file to the first byte in the section.
If the section type is SHT_NOBITS, offset specifies the conceptual placement of the file.
size
Specifies the size of the section in bytes.
If the section type is SHT_NOBITS, size may be non-zero; however, the section still occupies no space in the file.
type
Categorizes the section contents and semantics. Table 3–3 describes the section types.
Name
|
Value
|
Description
|
Interpretation by |
|
---|---|---|---|---|
info |
link |
|||
null |
0 |
Marks section header as inactive. |
|
|
progbits |
1 |
Contains information defined explicitly by the program. |
|
|
symtab |
2 |
Contains a symbol table for link editing. This table may also be used for dynamic linking; however, it may contain many unnecessary symbols. Note: Only one section of this type is allowed in a file |
One greater than the symbol table index of the last local symbol. |
The section header index of the associated string table. |
strtab |
3 |
Contains a string table. A file may have multiple string table sections. |
|
|
rela |
4 |
Contains relocation entries with explicit addends. A file may have multiple relocation sections. |
The section header index of the section to which the relocation applies. |
The section header index of the associated symbol table. |
hash |
5 |
Contains a symbol rehash table. Note: Only one section of this type is allowed in a file |
0 |
The section header index of the symbol table to which the hash table applies. |
dynamic |
6 |
Contains dynamic linking information. Note: Only one section of this type is allowed in a file |
0 |
The section header index of the string table used by entries in the section. |
note |
7 |
Contains information that marks the file. |
|
|
nobits |
8 |
Contains information defined explicitly by the program; however, a section of this type does not occupy any space in the file. |
|
|
rel |
9 |
Contains relocation entries without explicit addends. A file may have multiple relocation sections. |
The section header index of the section to which the relocation applies. |
The section header index of the associated symbol table. |
shlib |
10 |
Reserved. |
|
|
dynsym |
11 |
Contains a symbol table with a minimal set of symbols for dynamic linking. Note: Only one section of this type is allowed in a file |
One greater than the symbol table index of the last local symbol. |
The section header index of the associated string table. |
loproc hiproc |
0x70000000 0x7fffffff |
Lower and upper bound of range reserved for processor-specific semantics. |
|
|
louser hiuser |
0x80000000 0xffffffff |
Lower and upper bound of range reserved for application programs. Note: Section types in this range may be used by an application without conflicting with system-defined section types. |
|
|
Some section header table indexes are reserved and the object file will not contain sections for these special indexes.