You copied the Doc URL to your clipboard.

Compiler command-line options

Describes the most common ARM Compiler command-line options.

ARM Compiler provides many command-line options, including most Clang command-line options as well as a number of ARM-specific options. Additional information about command-line options is available:

  • The armclang Reference Guide provides more detail about a number of command-line options.
  • For a full list of Clang command-line options, consult the Clang and LLVM documentation.

Table 1-2 Compiler command-line options

Option Description
-c Performs the compilation step, but not the link step.
-xc -std=c90

Enables the compilation of C90 source code.

These are positional arguments and only affect subsequent input files on the command line.

-xc -std=c99

Enables the compilation of C99 source code.

These are positional arguments and only affect subsequent input files on the command line.

-xc++ -std=c++98

Enables the compilation of C++ source code.

These are positional arguments and only affect subsequent input files on the command line.

--target=arch-vendor-os-env

Enables code generation for the selected ARM architecture.

Valid values for --target include aarch64-arm-none-eabi to target the AArch64 state of the ARMv8-A architecture profile, armv8a-arm-none-eabi to target the AArch32 state of the ARMv8-A architecture profile, or armv7a-arm-none-eabi to target the ARMv7-A architecture profile.

-marm

Targets the A32 (ARMv8-A AArch32 state) or ARM (ARMv7-A) instruction set. For example --target=armv8a-arm-none-eabi --marm.

The -marm option is not valid for AArch64 targets. The compiler ignores the -marm option and generates a warning for AArch64 targets.

-mthumb

Targets the T32 (ARMv8-A AArch32 state) or Thumb (ARMv7-A) instruction set. For example --target=armv8a-arm-none-eabi -mthumb.

The -mthumb option is not valid for AArch64 targets. The compiler ignores the -mthumb option and generates a warning for AArch64 targets.

-D Defines a preprocessing macro.
-E Executes only the preprocessor step.
-I Adds the specified directories to the list of places that are searched to find included files.
-finline-functions Enables inlining of functions.
-Xlinker Specifies command-line options to pass to the linker when a link step is being performed after compilation.
-M Instructs the compiler to produce a list of makefile dependency lines suitable for use by a make utility.
-o Specifies the name of the output file.
-Onum Specifies the level of optimization to be used when compiling source files.
-Oz / -Os

Performs optimizations to reduce image size at the expense of a possible increase in execution time.

-Os balances code size against code speed. -Oz optimizes for code size.

By default, the compiler performs optimizations to reduce execution time at the expense of a possible increase in image size.

-S

Outputs the disassembly of the machine code generated by the compiler.

-v Shows how the compiler processes the command line. The commands are shown normalized, and the contents of any via files are expanded.
-fvectorize Enables the generation of Advanced SIMD vector instructions directly from C or C++ code.
-g Generates DWARF debug tables.
--version Displays version information and license details.
Was this page helpful? Yes No