The structure of an ARM ELF image
An ARM ELF image contains sections, regions, and segments, and each link stage has a different view of the image.
The structure of an image is defined by the:
Number of its constituent regions and output sections.
Positions in memory of these regions and sections when the image is loaded.
Positions in memory of these regions and sections when the image executes.
Each link stage has a different view of the image:
- ELF object file view (linker input)
The ELF object file view comprises input sections. The ELF object file can be:
A relocatable file that holds code and data suitable for linking with other object files to create an executable or a shared object file.
A shared object file that holds code and data.
- Linker view
The linker has two views for the address space of a program that become distinct in the presence of overlaid, position-independent, and relocatable program fragments (code or data):
The load address of a program fragment is the target address that the linker expects an external agent such as a program loader, dynamic linker, or debugger to copy the fragment from the ELF file. This might not be the address at which the fragment executes.
The execution address of a program fragment is the target address where the linker expects the fragment to reside whenever it participates in the execution of the program.
If a fragment is position-independent or relocatable, its execution address can vary during execution.
- ELF image file view (linker output)
The ELF image file view comprises program segments and output sections:
A load region corresponds to a program segment.
An execution region contains one or more of the following output sections:
- RO section.
- RW section.
- XO section.
- ZI section.
One or more execution regions make up a load region.
With armlink, the maximum size of a program segment is 2GB.
When describing a memory view:
The term root region means a region that has the same load and execution addresses.
Load regions are equivalent to ELF segments.
The following figure shows the relationship between the views at each link stage:
Figure 3-1 Relationship between sections, regions, and segments