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.

5.13 Inlining functions with <strong>the</strong> linker<br />

5.13.1 See also<br />

<strong>Using</strong> linker optimizations<br />

The linker can inline small functions in place of a branch instruction to that function. For <strong>the</strong><br />

linker to be able to do this, <strong>the</strong> function (without <strong>the</strong> return instruction) must fit in <strong>the</strong> four bytes<br />

of <strong>the</strong> branch instruction.<br />

Use <strong>the</strong> --inline and --no_inline command-line options to control branch inlining.<br />

If branch inlining optimization is enabled, <strong>the</strong> linker scans each function call in <strong>the</strong> image and<br />

<strong>the</strong>n inlines as appropriate. When <strong>the</strong> linker finds a suitable function to inline, it replaces <strong>the</strong><br />

function call with <strong>the</strong> instruction from <strong>the</strong> function that is being called.<br />

The linker applies branch inlining optimization before any unused sections are eliminated so<br />

that inlined sections can also be removed if <strong>the</strong>y are no longer called.<br />

Note<br />

The linker can inline two 16-bit instructions in place of <strong>the</strong> 32-bit Thumb BL instruction.<br />

Use <strong>the</strong> --info=inline command-line option to list all <strong>the</strong> inlined functions.<br />

Reference<br />

• Factors that influence function inlining on page 5-19<br />

• Elimination of unused sections on page 5-4.<br />

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

• --info=topic[,topic,...] on page 2-80<br />

• --inline, --no_inline on page 2-85.<br />

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

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!