You copied the Doc URL to your clipboard.

How the linker searches for the ARM standard libraries

The linker searches for the ARM® standard libraries using information specified on the command-line, or by examining environment variables.

By default, the linker searches for the ARM standard libraries in ../lib, relative to the location of the armlink executable. Use the --libpath command-line option to specify a different location.

Some libraries are stored in subdirectories. The linker will identify the subdirectories to use from a combination of the input objects and the value of the --stdlib option.

The --libpath command-line option

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, cpplib, and libcxx.

The sequential nature of the search ensures that armlink chooses the library that appears earlier in the list if two or more libraries define the same symbol. If you specify --stdlib, the library directory that armlink chooses depends on the value specified.

Library search order

The linker searches for libraries in the following order:

  1. Relative to the current path.

  2. At the location specified with the command-line option --libpath.

  3. At the location specified in ../lib.

How the linker selects ARM library variants

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.

The --no_scanlib option prevents the linker from searching the directories for the ARM standard libraries.

Related reference