You copied the Doc URL to your clipboard.

Using the compiler

Describes how to generate executable binaries, compile and link object files, and enable optimization options.

To generate an executable binary, compile a program using:

armclang -o example1 example1.c

You can also specify multiple source files on a single line. Each source file is compiled individually and then linked into a single executable binary:

armclang -o example1 example1a.c example1b.c

To compile each of your source files individually into an object file, specify the -c (compile-only) option, and then pass the resulting object files into another invocation of armclang to link them into an executable binary.

armclang -c -o example1a.o example1a.c
armclang -c -o example1b.o example1b.c
armclang -o example1 example1a.o example1b.o

To increase the optimization level, use the -Olevel option. The -O0 option is the lowest optimization level, while -O3 is the highest. Arm® C/C++ Compiler only performs auto-vectorization at -O2 and higher, and uses -O0 as the default setting. The optimization flag can be specified when generating a binary, such as:

armclang -O3 -o example1 example1.c

The optimization flag can also be specified when generating an object file:

armclang -O3 -c -o example1a.o example1a.c
armclang -O3 -c -o example1b.o example1b.c

 or when linking object files:

armclang -O3 -o example1 example1a.o example1b.o

Common compiler options

See armclang --help, Compiler options, and the LLVM documentation for more information about all supported options.


Outputs assembly code, rather than object code. Produces a text .s file containing annotated assembly code.


Performs the compilation step, but does not perform the link step. Produces an ELF object .o file. To later link object files into an executable binary, run armclang again, passing in the object files.

-o file

Specifies the name of the output file.


Targets an architecture profile, generating generic code that runs on any processor of that architecture. For example -march=armv8-a+sve.


Enables the compiler to automatically detect the CPU it is being run on and optimize accordingly. This supports a range of Armv8-A based SoCs, including ThunderX2.


Specifies the level of optimization to use when compiling source files. The default is -O0.


Describes the most common options supported by Arm C/C++ Compiler. Also, use man armclang to see more detailed descriptions of all the options.


Displays version information.