ELF’s section-based output supports attributes on a per-section basis.
These attributes include alloc, exec, write, progbits, and
align. Except for align, they can each be negated in NASM syntax by
prepending “no”, e.g., “noexec”. The attributes are later read by
the operating system to select the proper behavior for each section,
with the meanings shown in Table 9.1.
Table 9.1. ELF Section Attributes
| Attribute | Indicates the section |
|---|---|
| is loaded into memory at runtime. This is true for code and data sections, and false for metadata sections. |
| has permission to be run as executable code. |
| is writable at runtime. |
| is stored in the disk image, as opposed to allocated and initialized at load. |
| requires a memory alignment of |
In NASM syntax, the attribute nobits is provided as an alias for
noprogbits.
The standard primary sections have attribute defaults according their expected use, and any unknown section gets its own defaults, as shown in Table 9.2.
Table 9.2. ELF Standard Sections
| Section | alloc | exec | write | progbits | align |
|---|---|---|---|---|---|
| alloc | write | 4 | ||
| alloc | write | progbits | 4 | |
| alloc | progbits | 4 | ||
| alloc | exec | progbits | 16 | |
| progbits | 0 | |||
unknown | alloc | progbits | 1 |