SPRAB89A September 2011 – March 2014
The following are the program headers and segments.
p_align
As described in the System V ABI, loadable segments are aligned in the file such that their p_vaddr (address in memory) and p_offset (offset in the file) are congruent, modulo p_align. For the Linux ABI, p_align is specified to be 0x1000.
PT_INTERP Segment
The PT_INTERP segment contains the name of the object file containing the dynamic loader. For ELF executable files as described in this document, the interpreter is typically ld.so.
Read-Only Segments
Shared objects and executables must have a PT_LOAD segment with Read+Execute permission that contains the module's program code and shareable constants. A shareable constant is any object that is not writable and whose value does not consist of an address. This segment also includes the ELF structures needed to load and execute the program, including the file header, PT_INTERP, PT_PHDR, PT_DYNAMIC, PT_NOTE (if present) and PT_PHATTR (if present) segments.
Position-dependent executables may have additional read-only or Read+Execute segments with unspecified contents. If there are multiple such segments, it is not permitted to have PC-relative references between them. If the loader relocates them, it is not required to preserve their position relative to each other.
Data Segments
Shared objects and executables must have a single PT_LOAD segment with Read+Write permission that contains the module's DSBT, GOT, and read-write data. This segment is addressed using DP-relative addressing and is therefore marked with the PF_C6000_DPREL flag.
ELF requires uninitialized data in a segment to follow all the initialized data. However, if the DP-relative segment contains both uninitialized near data (e.g. .bss) and initialized far data (e.g. .fardata), the uninitialized data may need to precede the initialized data to be within range of the DP. In this case the linker is required to fill the uninitialized portion of the segment with 0.
Shared objects and executables may have additional Read+Write segments. For position independence, these sections must be addressed exclusively using GOT-based addressing. Position-dependent executables may use absolute addressing.
Stack Segment
The C6000 Linux ABI follows common convention by defining an additional segment type that enables toolchains to specify the minimum stack allocation for an executable.
Name | Value | Comment |
---|---|---|
PT_GNU_STACK | 0x6474E551 | Stack size and permission |
The p_flags member specifies the permissions on the segment containing the stack and is used to indicate whether the stack should be executable.
In the absence of this header, the size and permission of the stack remains unspecified.
Bound and Read-Only Segments
Linux executables and shared objects shall not contain segments marked as bound or read-only as described in Section 14.2.3.