Non-Confidential | ![]() | ARM 100073_0608_00_en | ||
| ||||
Home > The ARM C Micro-library > Building an application with microlib |
To build a program using microlib, you must use the command-line option --library_type=microlib
. This option can be used by the compiler, assembler or linker.
Use --library_type=microlib
with the linker
to override all other options.
--library_type
must be used with -Wl
.armclang --target arm-arm-none-eabi -march=armv8-a -Wl,--library_type=microlib main.c armclang --target arm-arm-none-eabi -march=armv8-a -c extra.c armlink --cpu=8-A.32 -o image.axf main.o extra.o
Specifying -Wl,--library_type=microlib
when compiling main.c results in an object file containing an attribute that asks the linker
to use microlib. Compiling extra.c with -Wl,--library_type=microlib
is unnecessary, because the request
to link against microlib exists in the object file generated by compiling main.c.
armclang --target arm-arm-none-eabi -march=armv8-a -c main.c armclang --target arm-arm-none-eabi -march=armv8-a -c extra.c armasm --cpu=8-A.32 --library_type=microlib more.s armlink --cpu=8-A.32 -o image.axf main.o extra.o more.o
The request to the linker to use microlib is made as a result of assembling
more.s with --library_type=microlib
.
armclang --target arm-arm-none-eabi -march=armv8-a -c main.c armclang --target arm-arm-none-eabi -march=armv8-a -c extra.c armlink --cpu=8-A.32 --library_type=microlib -o image.axf main.o extra.o
Neither object file contains the attribute requesting that the linker link against microlib, so the linker selects microlib as a result of being explicitly asked to do so on the command line.