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.

4.16 Overview of veneers<br />

4.16.1 See also<br />

Image structure and generation<br />

Veneers are small sections of code generated by <strong>the</strong> linker and inserted into your program. The<br />

BL instruction is PC-relative and has a limited branch range. Therefore, armlink must generate<br />

veneers when a branch involves a destination beyond <strong>the</strong> branching range of <strong>the</strong> BL instruction.<br />

The range of a BL instruction is 32MB for <strong>ARM</strong>, 16MB for Thumb-2, and 4MB for Thumb. A<br />

veneer extends <strong>the</strong> range of <strong>the</strong> branch by becoming <strong>the</strong> intermediate target of <strong>the</strong> branch<br />

instruction. The veneer <strong>the</strong>n sets <strong>the</strong> PC to <strong>the</strong> destination address. This enables <strong>the</strong> veneer to<br />

branch anywhere in <strong>the</strong> 4 GB address space. If <strong>ARM</strong> and Thumb are mixed, <strong>the</strong> veneer also<br />

handles processor state changes.<br />

The linker can generate <strong>the</strong> following veneer types depending on what is required:<br />

• inline veneers<br />

• short branch veneers<br />

• long branch veneers.<br />

armlink creates one input section called Veneer$$Code for each veneer. A veneer is generated<br />

only if no o<strong>the</strong>r existing veneer can satisfy <strong>the</strong> requirements. If two input sections contain a long<br />

branch to <strong>the</strong> same destination, only one veneer is generated that is shared by both branch<br />

instructions. A veneer is only shared in this way if it can be reached by both sections.<br />

If you are using <strong>ARM</strong>v4T, armlink generates veneers when a branch involves change of state<br />

between <strong>ARM</strong> and Thumb. You still get interworking veneers for <strong>ARM</strong>v5TE and later when<br />

using conditional branches, because <strong>the</strong>re is no conditional BL instruction.Veneers for state<br />

changes are also required for B instructions in <strong>ARM</strong>v5 and later.<br />

Concepts<br />

• Veneer sharing on page 4-27<br />

• Veneer types on page 4-28<br />

• Generation of position independent to absolute veneers on page 4-29<br />

• Reuse of veneers when scatter-loading on page 4-30.<br />

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

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!