Command-line options

This page lists the command-line options currently supported by armclang and armclang++, which are based on Clang front‑end, and the LLVM-based optimization and code generation back‑end.

 Note: For simplicity, we have shown usage with armclang. The option can also be used with armclang++, unless otherwise stated.

Actions

Options that control what action to perform on the input.

Option Description Usage
-E Only run the preprocessor. armclang ‑E
-S Only run preprocess and compilation steps. armclang ‑S
-c Only run preprocess, compile, and assemble steps. armclang ‑c
-fopenmp Enable OpenMP, and link in the OpenMP library libomp. armclang ‑fopenmp
-fsyntax-only Show syntax errors but do not perform any compilation. armclang ‑fsyntax-only

File options

Options that specify input or output files.

Option Description Usage
-I<dir> Add directory to include search path. armclang ‑I<dir>
-include<file>
--include<file>             
Include file before parsing. armclang ‑include <file>
armclang ‑‑include <file>
-o<file> Write output to <file>. armclang ‑o <file>

Basic driver options

Options that affect basic functionality of the armclang driver.

Option Description Usage
-gcc‑toolchain=<arg>              Use the gcc toolchain at the given directory. armclang ‑‑gcc‑toolchain=<arg>
-help
--help
Display available options. armclang ‑help
armclang ‑‑help
-help‑hidden Display hidden options. Only use these options if advised to do so by your Arm representative. armclang ‑‑help‑hidden
-v Show commands to run and use verbose output. armclang ‑v
--version
--vsn
Show the version number and some other basic information about the compiler. armclang ‑‑version
armclang ‑‑vsn

Optimization options

Options that control optimization behavior and performance.

Option Description Usage
-O0 Minimum optimization for the performance of the compiled binary.
Turns off most optimizations. When debugging is enabled, this option generates code that directly corresponds to the source code. Therefore, this might result in a significantly larger image.
This is the default optimization level.
armclang ‑O0
-O1 Restricted optimization.
When debugging is enabled, this option gives the best debug view for the trade-off between image size, performance, and debug.
armclang ‑O1
-O2 High optimization.
When debugging is enabled, the debug view might be less satisfactory because the mapping of object code to source code is not always clear.
The compiler might perform optimizations that cannot be described by debug information.
armclang ‑O2
-O3 Very high optimization.
When debugging is enabled, this option typically gives a poor debug view.
Arm recommends debugging at lower optimization levels.
armclang ‑O3
-Ofast Enables all the optimizations from level 3 including those performed with the ‑ffp‑mode=fast armclang option. This level also performs other aggressive optimizations that might violate strict compliance with language standards. armclang ‑Ofast
-ffast‑math Allow aggressive, lossy floating-point optimizations. armclang ‑ffast‑math
-ffinite‑math‑only Enable optimizations that ignore the possibility of NaN and +/‑Inf. armclang ‑ffinite‑math‑only
‑ffp‑contract={fast on | off} Controls when the compiler is permitted to form fused floating-point operations (such as FMAs).
  • fast: Always, except when using -O0 to set the optimization level to 0.
  • on: Only in the presence of the FP_CONTRACT pragma (default).
  • off: Never.
armclang ‑ffp‑contract={fast on | off}
-finline
-fno-inline
Enable/disable inlining (enabled by default). armclang ‑finline (enable)
armclang ‑fno‑inline (disable)
-fstrict‑aliasing Tells the compiler to adhere to the aliasing rules defined in the source language.
In some circumstances, this flag allows the compiler to assume that pointers to different types do not alias. Enabled by default when using ‑Ofast.
armclang ‑fstrict‑aliasing
‑funsafe‑math‑optimizations
‑fno‑unsafe‑math‑optimizations
This option enables reassociation and reciprocal math optimizations, and does not honor trapping nor signed zero. armclang ‑funsafe‑math‑optimizations (enable this option)
armclang ‑fno‑unsafe‑math‑optimizations (disable this option)
-fvectorize
-fno-vectorize
Enable/disable loop vectorization (enabled when using -O2 to set the optimization level to 2). armclang ‑fvectorize (enable this option)
armclang ‑fno‑vectorize (disable this option)
-mcpu=<arg> Select which CPU architecture to optimize for ‑mcpu=native causes the compiler to auto-detect the CPU architecture from the build computer. armclang ‑mcpu=<arg>

Workload compilation options

Options that affect the way C language workloads compile.

Option Description Usage
-fsimdmath
‑fno‑simdmath
Enable use of vectorized libm library (libsimdmath) to aid vectorization of loops containing calls to libm. For more information, see https://developer.arm.com/products/software-development-tools/hpc/documentation/vector-math-routines. armclang ‑fsimdmath
armclang ‑fno‑simdmath
‑std=<arg> Language standard to compile for. The list of valid standards depends on the input language, but adding ‑std=<arg> to a build line will generate an error message listing valid choices. armclang ‑std=<arg>
armclang ‑‑std=<arg>

Development options

Options that support code development.

Option Description Usage
-fcolor-diagnostics
-fno-color-diagnostics
Use colors in diagnostics. armclang -fcolor-diagnostics
armclang -fno-color-diagnostics
-g Generate source-level debug information. armclang -g

Warning options

Options that control the behavior of warnings.

Option Description Usage
-W<warning> Enable the specified warning.
Similarly, warnings can be disabled with -Wno-<warning>.
armclang -W<warning>
-Wall Enable all warnings. armclang -Wall
-w Suppress all warnings. armclang -w

Preprocessor options

Options that control preprocessor behavior.

Option Description Usage
-D<macro>=<value> Define <macro> to <value> (or 1 if <value> omitted). armclang -D<macro>=<value>
-U<macro> Undefine macro <macro>. armclang -U<macro>

Linker options

Options that control linking behavior and performance.

Option Description Usage
-Wl,<arg>,<arg2>... Pass the comma separated arguments in <arg> to the linker. armclang ‑Wl,<arg>,<arg2>...
-Xlinker <arg> Pass <arg> to the linker. armclang ‑Xlinker <arg>
-l<library> Search for the library named <library> when linking. armclang ‑l<library>
-shared
--shared
Causes library dependencies to be resolved at runtime by the loader.
This is the inverse of ‑static. If both options are given, all but the last option will be ignored.
armclang ‑shared
armclang ‑‑shared
-static
--static
Causes library dependencies to be resolved at link time.
This is the inverse of ‑shared. If both options are given, all but the last option is ignored.
armclang ‑static
armclang ‑‑static