You copied the Doc URL to your clipboard.


Tells the compiler to not use the ARM® standard C and C++ libraries.

If you use the -nostdlib option, armclang does not collude with the ARM standard library and only emits calls to AEABI compliant library functions. The output from armclang works with any ISO C library that is compliant with AEABI.

The -nostdlib armclang option, passes the --no_scanlib linker option to armlink. Therefore you must specify the location of the libraries you want to use as input objects to armlink, or with the --userlibpath armlink option.


If you want to use your own libraries instead of the ARM standard libraries or if you want to re-implement the standard library functions, then you must use the -nostdlib armclang option. Your libraries must be compliant with the ISO C library and with the AEABI specification.


-nostdlib is disabled by default.


#include "math.h" 

double foo(double d) 
    return sqrt(d + 1.0);
int main(int argc, char *argv[])
    return foo(argc);

Compiling this code with -nostdlib generates a call to sqrt (from the ARM standard library), which is AEABI compliant.

armclang --target=arm-arm-none-eabi -mcpu=Cortex-A9 -O0 -S -o- file.c -mfloat-abi=hard -nostdlib

Compiling this code without -nostdlib generates a call to __hardfp_sqrt (from the ARM standard library), which is not AEABI compliant.

armclang --target=arm-arm-none-eabi -mcpu=Cortex-A9 -O0 -S -o- file.c -mfloat-abi=hard
Was this page helpful? Yes No