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.

Image structure and generation<br />

4.23 How <strong>the</strong> linker performs library searching, selection, and scanning<br />

4.23.1 See also<br />

The linker always searches user libraries before <strong>the</strong> <strong>ARM</strong> libraries. If you specify <strong>the</strong><br />

--no_scanlib command-line option, <strong>the</strong> linker does not search for <strong>the</strong> default <strong>ARM</strong> libraries and<br />

uses only those libraries that are specified in <strong>the</strong> input file list to resolve references.<br />

The linker creates an internal list of libraries as follows:<br />

1. Any libraries explicitly specified in <strong>the</strong> input file list are added to <strong>the</strong> list.<br />

2. The user-specified search path is examined to identify <strong>ARM</strong> standard libraries to satisfy<br />

requests embedded in <strong>the</strong> input objects.<br />

The best-suited library variants are chosen from <strong>the</strong> searched directories and <strong>the</strong>ir<br />

subdirectories. Libraries supplied by <strong>ARM</strong> have multiple variants that are named<br />

according to <strong>the</strong> attributes of <strong>the</strong>ir members.<br />

Be aware of <strong>the</strong> following differences between <strong>the</strong> way <strong>the</strong> linker adds object files to <strong>the</strong> image<br />

and <strong>the</strong> way it adds libraries to <strong>the</strong> image:<br />

• Each object file in <strong>the</strong> input list is added to <strong>the</strong> output image unconditionally, whe<strong>the</strong>r or<br />

not anything refers to it. At least one object must be specified.<br />

• A member from a library is included in <strong>the</strong> output only if:<br />

— an object file or an already-included library member makes a non-weak reference<br />

to it<br />

— <strong>the</strong> linker is explicitly instructed to add it.<br />

Note<br />

If a library member is explicitly requested in <strong>the</strong> input file list, <strong>the</strong> member is loaded even<br />

if it does not resolve any current references. In this case, an explicitly requested member<br />

is treated as if it is an ordinary object.<br />

Unresolved references to weak symbols do not cause library members to be loaded.<br />

Tasks<br />

• About weak references and definitions on page 4-32<br />

• Controlling how <strong>the</strong> linker searches for <strong>the</strong> <strong>ARM</strong> standard libraries on page 4-36.<br />

Reference<br />

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

• --keep=section_id on page 2-89<br />

• --remove, --no_remove on page 2-134<br />

• --scanlib, --no_scanlib on page 2-141.<br />

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

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!