section

Defines a section of an ELF (Executable and Linkable Format) object file.

  .section name [,alignment [,type [,flags]]]

  
Parameters

name

Name of the section.

alignment

Alignment boundary.

type

Numeric value for the ELF section type, per ELF Section Header Types (SHT) . The default type value is 1: (SHT_PROGBITS).

flags

Numeric value for the ELF section flags, per ELF Section Header Flags (SHF) . The default flags value is 0x00000002, 0x00000001: (SHF_ALLOC+SHF_WRITE).

Table 1. ELF Section Header Types (SHT)
Type Name Meaning
0 NULL Section header is inactive.
1 PROGBITS Section contains information that the program defines.
2 SYMTAB Section contains a symbol table.
3 STRTAB Section contains a string table.
4 RELA Section contains relocation entries with explicit addends.
5 HASH Section contains a symbol hash table.
6 DYNAMIC Section contains information used for dynamic linking.
7 NOTE Section contains information that marks the file, often for compatibility purposes between programs.
8 NOBITS Section occupies no space in the object file.
9 REL Section contains relocation entries without explicit addends.
10 SHLIB Section has unspecified semantics, so does not conform to the Application Binary Interface (ABI) standard.
11 DYNSYM Section contains a minimal set of symbols for dynamic linking.
Table 2. ELF Section Header Flags (SHF)
Flag Name Meaning
0x00000001 WRITE Section contains data that is writable during execution.
0x00000002 ALLOC Section occupies memory during execution.
0x00000004 EXECINSTR Section contains executable machine instructions.
0xF0000000 MASKPROC Bits this mask specifies are reserved for processor-specific purposes.
Remark

Use this directive to create arbitrary relocatable sections, including sections to be loaded at an absolute address.

Possiblesyntaxforms

The section directive accepts a number of different syntax forms, partly for convenience and partly for compatibility with other assemblers. A section declaration requires four pieces of information: a section name, alignment, ELF section type (for example, SHT_PROGBITS) and ELF section flags (for example, SHF_ALLOC+SHF_EXECINSTR).

The possible syntax forms are as follows: