| |||
| Home > Image structure and generation > Controlling how the linker searches for the ARM standard libraries | |||
By default, the linker searches for the ARM standard libraries
in ../lib, relative to the location of the armlink executable.
You can also control how the linker searches for the ARM standard libraries
with either the --libpath command-line option or
the ARMLIB or ARMCC environment variables.nLIB
Some libraries are stored in subdirectories. If the compiler
requires a library from a particular subdirectory, it adds an import
of a special symbol to identify the subdirectory to the linker.
The names of subdirectories are placed in each compiled object by
using a symbol of the form Lib$$Request$$.sub_dir_name
Use the --libpath command-line option with
a comma-separated list of parent directories. This list must end
with the parent directory of the ARM library directories armlib and cpplib.
The linker searches subdirectories given by the symbol Lib$$Request$$,
if you include the path separator character on the end of the library
path:sub_dir_name
\ on
Windows
/ on Red Hat Linux.
For example, for --libpath=mylibs\ and
the symbol Lib$$Request$$armlib the linker searches the
directories:
mylibs mylibs\armlib
When the linker command-line option --libpath is
used, any paths specified by the ARMCC variable
are not searched.nLIB
The sequential nature of the search ensures that the linker chooses the library that appears earlier in the list if two or more libraries define the same symbol.
You can use either of the ARMLIB or ARMCC environment
variables to specify a library path.nLIB
The linker searches subdirectories given by the symbol Lib$$Request$$,
if you include the path separator character on the end of the path
specified in sub_dir_nameARMCC:nLIB
\ on
Windows
/ on Red Hat Linux.
For example, if ARMCC5LIB is set to ,
the linker searches the directories:install_directory\lib\
lib lib\armlib lib\cpplib
The linker searches for libraries in the following order:
Relative to the current path.
At the location specified with the command-line
option --libpath.
At the location specified in ARMCC.nLIB
At the location specified in ARMLIB.
At the location specified in ../lib.
The ARM Compiler toolchain includes a number of variants of each of the libraries, that are built using different build options. For example, architecture versions, endianness, and instruction set. The variant of the ARM library is coded into the library name. The linker must select the best-suited variant from each of the directories identified during the library search.
The linker accumulates the attributes of each input object and then selects the library variant best suited to those attributes. If more than one of the selected libraries are equally suited, the linker retains the first library selected and rejects all others.
Linker Reference:
Using ARM® C and C++ Libraries and Floating-Point Support:
ARM® C and C++ Libraries and Floating-Point Support Reference:
Introducing the ARM Compiler toolchain: