ROUND
Attribute (LOAD
,
RESERVE
)
The ROUND
attribute is used to align the offset of the first
section of a segment within the file image being created. By default, sections within
a file image are concatenated together based on the alignment requirements of each
section. Padding is added by the link editor between sections to ensure that the
overall alignment requirement for each section are met. This model produces the
most compact file image, but can yield segment offsets within the file image that
do not align with virtual memory pages. The ROUND
attribute can
be used to align segment offsets optimally for mapping to a memory image.
The alignment of the first segment in an ELF object is sufficient
to create an optimal mapping without the use of ROUND
.
ROUND
is commonly used on segments other than the first, usually
for the data segment that follows the text segment.
Note:
The first segment typically starts with ELF headers, followed by section data.ROUND
applies to the section data. As such,
the application of ROUND
to the first segment can require the link-editor
to introduce a padding gap between the headers and the section data.
The rounding value specified must be 0 or a power of 2. By default, the link-editor
sets the rounding factor of a segment to 1, meaning that the segment size is not
rounded up. The system provides /usr/lib/ld/map.pagealign
to set alignments that are the most appropriate for memory mapping on a given platform.