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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Using</strong> scatter files<br />

Example 8-23 Position-independent code<br />

LR_1 0x010000 PI ; The first load region is at 0x010000.<br />

{<br />

ER_RO +0 ; The PI attribute is inherited from parent.<br />

; The default execution address is 0x010000, but <strong>the</strong> code can be moved.<br />

{<br />

* (+RO) ; All <strong>the</strong> RO sections go here.<br />

}<br />

ER_RW +0 ABSOLUTE ; PI attribute is overridden by ABSOLUTE.<br />

{<br />

* (+RW) ; The RW sections are placed next. They cannot be moved.<br />

}<br />

ER_ZI +0 ; ER_ZI region placed after ER_RW region.<br />

{<br />

* (+ZI) ; All <strong>the</strong> ZI sections are placed consecutively here.<br />

}<br />

}<br />

8.38.2 See also<br />

ER_RO, <strong>the</strong> RO execution region, inherits <strong>the</strong> PI attribute from <strong>the</strong> load region LR_1. The next<br />

execution region, ER_RW, is marked as ABSOLUTE and uses <strong>the</strong> +offset form of base designator.<br />

This prevents ER_RW from inheriting <strong>the</strong> PI attribute from ER_RO. Also, because <strong>the</strong> ER_ZI region<br />

has an offset of +0, it inherits <strong>the</strong> ABSOLUTE attribute from <strong>the</strong> ER_RW region.<br />

Concepts<br />

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

• About load region descriptions on page 4-5<br />

• Considerations when using a relative address +offset for load regions on page 4-16<br />

• Considerations when using a relative address +offset for execution regions on page 4-17.<br />

Reference<br />

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

• --reloc on page 2-132<br />

• --ro_base=address on page 2-135<br />

• --ropi on page 2-136<br />

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

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

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!