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.24 Controlling how <strong>the</strong> linker searches for <strong>the</strong> <strong>ARM</strong> standard libraries<br />

You can control how <strong>the</strong> linker searches for <strong>the</strong> <strong>ARM</strong> standard libraries with <strong>the</strong> <strong>ARM</strong>CC41LIB<br />

environment variable or <strong>the</strong> --libpath command-line option.<br />

Some libraries are stored in subdirectories. If <strong>the</strong> compiler requires a library from a particular<br />

subdirectory, it adds an import of a special symbol to identify <strong>the</strong> subdirectory to <strong>the</strong> linker. The<br />

names of subdirectories are placed in each compiled object by using a symbol of <strong>the</strong> form<br />

Lib$$Request$$sub_dir_name.<br />

4.24.1 <strong>Using</strong> <strong>the</strong> --libpath command-line option<br />

Use <strong>the</strong> --libpath command-line option with a comma-separated list of parent directories. This<br />

list must end with <strong>the</strong> parent directory of <strong>the</strong> <strong>ARM</strong> library directories armlib and cpplib. The<br />

<strong>ARM</strong>CC41LIB environment variable holds this path.<br />

The linker searches subdirectories given by <strong>the</strong> symbol Lib$$Request$$sub_dir_name, if you<br />

include <strong>the</strong> path separator character on <strong>the</strong> end of <strong>the</strong> library path:<br />

• \ on Windows<br />

• / on Red Hat Linux.<br />

For example, for --libpath=mylibs\ and <strong>the</strong> symbol Lib$$Request$$armlib <strong>the</strong> linker searches<br />

<strong>the</strong> directories:<br />

mylibs<br />

mylibs\armlib<br />

Note<br />

When <strong>the</strong> linker command-line option --libpath is used, <strong>the</strong> paths specified by <strong>the</strong> <strong>ARM</strong>CC41LIB<br />

variable are not searched.<br />

The sequential nature of <strong>the</strong> search ensures that <strong>the</strong> linker chooses <strong>the</strong> library that appears earlier<br />

in <strong>the</strong> list if two or more libraries define <strong>the</strong> same symbol.<br />

4.24.2 <strong>Using</strong> <strong>the</strong> <strong>ARM</strong>CC41LIB or <strong>ARM</strong>LIB environment variable<br />

You can use ei<strong>the</strong>r of <strong>the</strong> <strong>ARM</strong>LIB or <strong>ARM</strong>CC41LIB environment variables to specify a library path.<br />

<strong>ARM</strong>CC41LIB is <strong>the</strong> default.<br />

The linker searches subdirectories given by <strong>the</strong> symbol Lib$$Request$$sub_dir_name, if you<br />

include <strong>the</strong> path separator character on <strong>the</strong> end of <strong>the</strong> path specified in <strong>ARM</strong>CC41LIB:<br />

• \ on Windows<br />

• / on Red Hat Linux.<br />

For example, if <strong>ARM</strong>CC41LIB is set to install_directory\...\lib\, <strong>the</strong> linker searches <strong>the</strong><br />

directories:<br />

lib<br />

lib\armlib<br />

lib\cpplib<br />

4.24.3 Library search order<br />

The linker searches for libraries in <strong>the</strong> following order:<br />

1. Relative to <strong>the</strong> current path.<br />

2. At <strong>the</strong> location specified with <strong>the</strong> command-line option --libpath.<br />

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

ID080411 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!