The section header table has all of the information necessary to locate and isolate each of the file's sections. A section header entry in a section header table contains information characterizing the contents of the corresponding section, if the file has such a section.
Each entry in the section header table is a section header. A section header is a structure of fixed size and format, consisting of the following fields, or members:
Specifies the section name. The value of this field is an index into the section header string table section, wherein it indicates the beginning of a null-terminated string that names the section.
Categorizes the section's contents and semantics. Table 3-3 describes the section types.
One-bit descriptions of section attributes. Table 3-2 describes the section attribute flags.
Address where the first byte resides if the section appears in the memory image of a process; a value of 0 indicates the section does not appear in the memory image of a process.
Specifies the byte offset from the beginning of the file to the first byte in the section.
If the section type is SHT_NOBITS, the corresponding section occupies no space in the file. In this case, sh_offset specifies the location at which the section would have begun if it did occupy space within the file.
Specifies the size, in byte units, of the section.
Even if the section type is SHT_NOBITS, sh_size can be nonzero; however, the corresponding section still occupies no space in the file.
Section header table index link. The interpretation of this information depends on the section type, as described in Table 3-3.
Extra information. The interpretation of this information depends on the section type, as described in Table 3-3.
If a section has an address alignment constraint, the value in this field is the modulus, in byte units, by which the value of sh_addr must be congruent to 0; i.e., sh_addr = 0 (mod sh_addralign). For example, if a section contains a long (32 bits), the entire section must be ensured long alignment, so sh_addralign has the value 4. Only 0 and positive integral powers of 2 are currently allowed as values for this field. A value of 0 or 1 indicates no address alignment constraints.
Size, in byte units, for entries in a section that is a table of fixed-size entries, such as a symbol table. Has the value 0 if the section is not a table of fixed-size entries
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. |
Table 3-3 Section Types
Name |
Value |
Description |
Interpretation by |
|
---|---|---|---|---|
sh_info |
sh_link |
|||
SHT_NULL |
0 |
Marks section header as inactive; file has no corresponding section. |
0 |
SHN_UNDEF |
SHT_PROGBITS |
1 |
Contains information defined by the program, and in a format and with a meaning determined solely by the program. |
0 |
SHN_UNDEF |
SHT_SYMTAB |
2 |
Is a complete symbol table, usually for link editing. This table can also be used for dynamic linking; however, it can 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. |
SHT_STRTAB |
3 |
Is a string table. A file can have multiple string table sections. |
0 |
SHN_UNDEF |
SHT_RELA |
4 |
Contains relocation entries with explicit addends. A file can have multiple relocation sections. |
The section header index of the section to where the relocation applies. |
The section header index of the associated symbol table. |
SHT_HASH |
5 |
Is 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. |
SHT_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. |
SHT_NOTE |
7 |
Contains information that marks the file. |
0 |
SHN_UNDEF |
SHT_NOBITS |
8 |
Contains information defined by the program, and in a format and with a meaning determined by the program. However, a section of this type occupies no space in the file, but the section header's offset field specifies the location at which the section would have begun if it did occupy space within the file. |
0 |
SHN_UNDEF |
SHT_REL |
9 |
Contains relocation entries without explicit addends. A file can have multiple relocation sections. |
The section header index of the section to where the relocation applies. |
The section header index of the associated symbol table. |
SHT_SHLIB |
10 |
Reserved. |
0 |
SHN_UNDEF |
SHT_DYNSYM |
11 |
Is 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. |
SHT_LOPROC SHT_HIPROC |
0x70000000 0x7fffffff |
Lower and upper bounds of range of section types reserved for processor-specific semantics. |
0 |
SHN_UNDEF |
|
||||
SHT_LOUSER SHT_HIUSER |
0x80000000 0xffffffff |
Lower and upper bounds of range of section types reserved for application programs. Note: Section types in this range can be used by an application without conflicting with system-defined section types. |
0 |
SHN_UNDEF |
Some section header table indices are reserved, and the object file does not contain sections for these special indices.