06.02.2013 Views

ARM Compiler toolchain Using the Linker - ARM Information Center

ARM Compiler toolchain Using the Linker - ARM Information Center

ARM Compiler toolchain Using the Linker - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.13 Section alignment with <strong>the</strong> linker<br />

4.13.1 See also<br />

Image structure and generation<br />

When input sections have been ordered and before <strong>the</strong> base addresses are fixed, armlink inserts<br />

padding, if required, to force each input section to start at an address that is a multiple of <strong>the</strong><br />

input section alignment.<br />

The linker permits ELF program headers and output sections to be aligned on a four-byte<br />

boundary regardless of <strong>the</strong> maximum alignment of <strong>the</strong> input sections. This enables armlink to<br />

minimize <strong>the</strong> amount of padding that it inserts into <strong>the</strong> image.<br />

If you require strict conformance with <strong>the</strong> ELF specification <strong>the</strong>n use <strong>the</strong> --no_legacyalign<br />

option. The linker faults <strong>the</strong> base address of a region if it is not aligned so padding might be<br />

inserted to ensure compliance. When --no_legacyalign is used <strong>the</strong> region alignment is <strong>the</strong><br />

maximum alignment of any input section contained by <strong>the</strong> region.<br />

If you are using scatter-loading, you can increase <strong>the</strong> alignment of a load region or execution<br />

region with <strong>the</strong> ALIGN attribute. For example, you can change an execution region that is<br />

normally four-byte aligned to be eight-byte aligned. However, you cannot reduce <strong>the</strong> natural<br />

alignment. For example, you cannot force two-byte alignment on a region that is normally<br />

four-byte aligned.<br />

Tasks<br />

• About creating regions on page boundaries on page 8-54.<br />

Reference<br />

<strong>Linker</strong> Reference:<br />

• --legacyalign, --no_legacyalign on page 2-95<br />

• Load region attributes on page 4-7<br />

• Execution region attributes on page 4-11<br />

• Example of aligning a base address in execution space but still tightly packed in load<br />

space on page 4-41.<br />

<strong>ARM</strong> DUI 0474C Copyright © 2010-2011 <strong>ARM</strong>. All rights reserved. 4-22<br />

ID080411 Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!