Keil Logo

Technical Support

On-Line Manuals

Compiler Reference Guide

Preface Arm Compiler Tools Overview armclang Reference armclang Command-line Options Summary of armclang command-line options -C (armclang) -c (armclang) -D -E -e -fbare-metal-pie -fbracket-depth=N -fcommon, -fno-common -fdata-sections, -fno-data-sections -ffast-math, -fno-fast-math -ffixed-rN -ffp-mode -ffunction-sections, -fno-function-sections -fident, -fno-ident @file -fldm-stm, -fno-ldm-stm -fno-builtin -fno-inline-functions -flto, -fno-lto -fexceptions, -fno-exceptions -fomit-frame-pointer, -fno-omit-frame-pointer -fpic, -fno-pic -fropi, -fno-ropi -fropi-lowering, -fno-ropi-lowering -frwpi, -fno-rwpi -frwpi-lowering, -fno-rwpi-lowering -fsanitize -fshort-enums, -fno-short-enums -fshort-wchar, -fno-short-wchar -fstack-protector, -fstack-protector-all, -fstack- -fstrict-aliasing, -fno-strict-aliasing -fsysv, -fno-sysv -ftrapv -fvectorize, -fno-vectorize -fvisibility -fwrapv -g, -gdwarf-2, -gdwarf-3, -gdwarf-4 (armclang) -I -include -L -l -M, -MM -MD, -MMD -MF -MG -MP -MT -march -marm -masm -mbig-endian -mbranch-protection -mcmodel -mcmse -mcpu -mexecute-only -mfloat-abi -mfpu -mimplicit-it -mlittle-endian -mno-neg-immediates -moutline, -mno-outline -mpixolib -munaligned-access, -mno-unaligned-access -mthumb -nostdlib -nostdlibinc -o (armclang) -O (armclang) -pedantic -pedantic-errors -Rpass -S -save-temps -shared (armclang) -std --target -U -u (armclang) -v (armclang) --version (armclang) --version_number (armclang) --vsn (armclang) -W -Wl -Xlinker -x (armclang) -### Compiler-specific Keywords and Operators Compiler-specific keywords and operators __alignof__ __asm __declspec attributes __declspec(noinline) __declspec(noreturn) __declspec(nothrow) __inline __promise __unaligned Global named register variables Compiler-specific Function, Variable, and Type Att Function attributes __attribute__((always_inline)) function attribute __attribute__((cmse_nonsecure_call)) function attr __attribute__((cmse_nonsecure_entry)) function att __attribute__((const)) function attribute __attribute__((constructor(priority))) function at __attribute__((format_arg(string-index))) function __attribute__((interrupt("type"))) function attrib __attribute__((malloc)) function attribute __attribute__((naked)) function attribute __attribute__((noinline)) function attribute __attribute__((nonnull)) function attribute __attribute__((noreturn)) function attribute __attribute__((nothrow)) function attribute __attribute__((pcs("calling_convention"))) functio __attribute__((pure)) function attribute __attribute__((section("name"))) function attribut __attribute__((unused)) function attribute __attribute__((used)) function attribute __attribute__((value_in_regs)) function attribute __attribute__((visibility("visibility_type"))) fun __attribute__((weak)) function attribute __attribute__((weakref("target"))) function attrib Type attributes __attribute__((aligned)) type attribute __attribute__((packed)) type attribute __attribute__((transparent_union)) type attribute Variable attributes __attribute__((alias)) variable attribute __attribute__((aligned)) variable attribute __attribute__((deprecated)) variable attribute __attribute__((packed)) variable attribute __attribute__((section("name"))) variable attribut __attribute__((unused)) variable attribute __attribute__((used)) variable attribute __attribute__((visibility("visibility_type"))) var __attribute__((weak)) variable attribute __attribute__((weakref("target"))) variable attrib Compiler-specific Intrinsics __breakpoint intrinsic __current_pc intrinsic __current_sp intrinsic __disable_fiq intrinsic __disable_irq intrinsic __enable_fiq intrinsic __enable_irq intrinsic __force_stores intrinsic __memory_changed intrinsic __schedule_barrier intrinsic __semihost intrinsic __vfp_status intrinsic Compiler-specific Pragmas #pragma clang system_header #pragma clang diagnostic #pragma clang section #pragma once #pragma pack(...) #pragma unroll[(n)], #pragma unroll_completely #pragma weak symbol, #pragma weak symbol1 = symbol Other Compiler-specific Features ACLE support Predefined macros Inline functions Half-precision floating-point data types Half-precision floating-point number format Half-precision floating-point intrinsics Library support for _Float16 data type BFloat16 floating-point number format TT instruction intrinsics Non-secure function pointer intrinsics armclang Integrated Assembler Syntax of assembly files for integrated assembler Assembly expressions Alignment directives Data definition directives String definition directives Floating-point data definition directives Section directives Conditional assembly directives Macro directives Symbol binding directives Org directive AArch32 Target selection directives AArch64 Target selection directives Space-filling directives Type directive Integrated assembler support for the CSDB instruct armclang Inline Assembler Inline Assembly File-scope inline assembly Inline assembly statements within a function Assembly string Output and input operands Clobber list volatile Inline assembly constraint strings Constraint modifiers Constraint codes Constraint codes common to AArch32 state and AArch Constraint codes for AArch32 state Constraint codes for AArch64 state Using multiple alternative operand constraints Inline assembly template modifiers Template modifiers common to AArch32 state and AAr Template modifiers for AArch32 state Template modifiers for AArch64 state Forcing inline assembly operands into specific reg Symbol references and branches into and out of inl Duplication of labels in inline assembly statement armlink Reference fromelf Reference armar Reference armasm Legacy Assembler Reference Appendixes

Summary of armclang command-line options

B1.1 Summary of armclang command-line options

This provides a summary of the armclang command-line options that Arm® Compiler 6 supports.

Note:

This topic includes descriptions of [ALPHA], [BETA], and [COMMUNITY] features. See Support level definitions.

The command-line options either affect both compilation and assembly, or only affect compilation. The command-line options that only affect compilation without affecting armclang integrated assembler are shown in the table as Compilation only. The command-line options that affect both compilation and assembly are shown in the table as Compilation and assembly.

Note:

The command-line options that affect assembly are for the armclang integrated assembler, and do not apply to armasm. These options affect both inline assembly and assembly language source files.

Note:

Assembly language source files are assembled using the armclang integrated assembler. C and C++ language source files, which can contain inline assembly code, are compiled using the armclang compiler. Command-line options that are shown as Compilation only do not affect the integrated assembler, but they can affect inline assembly code.

Table B1-1 armclang command-line options

Option Description Compilation or Assembly
‑C Keep comments in the preprocessed output. Compilation and assembly.
‑c Only perform the compile step, do not invoke armlink. Compilation and assembly.
‑D Defines a preprocessor macro. Compilation and assembly.
‑E Only perform the preprocess step, do not compile or link. Compilation and assembly.
‑e Specifies the unique initial entry point of the image. Compilation and assembly.
‑fbare‑metal‑pie Generates position-independent code. AArch32 state only. This option is deprecated. Compilation only.

‑fbracket‑depth

Sets the limit for nested parentheses, brackets, and braces. Compilation and assembly.

‑fcommon,

‑fno‑common

Generates common zero-initialized values for tentative definitions. Compilation only.

‑fdata‑sections,

‑fno‑data‑sections

Enables or disables the generation of one ELF section for each variable in the source file. Compilation only.

‑ffast‑math,

‑fno‑fast‑math

Enables or disables the use of aggressive floating-point optimizations. Compilation only.

‑ffixed‑rN

Prevents the compiler from using the specified core register, unless the use is for Arm ABI compliance. Compilation only.

‑ffp‑mode

Specifies floating-point standard conformance. Compilation only.

‑ffunction‑sections,

‑fno‑function‑sections

Enables or disables the generation of one ELF section for each function in the source file. Compilation only.

‑fident,

‑fno‑ident

Controls whether the output file contains the compiler name and version information. Compilation only.
@file Reads a list of command-line options from a file. Compilation and assembly.

‑fldm‑stm,

‑fno‑ldm‑stm

Enable or disable the generation of LDM and STM instructions. AArch32 only. Compilation only.
‑fno‑inline‑functions Disables the automatic inlining of functions at optimization levels ‑O2 and ‑O3. Compilation only.
‑flto Enables link time optimization, and outputs bitcode wrapped in an ELF file for link time optimization. Compilation only.

‑fexceptions,

‑fno‑exceptions

Enables or disables the generation of code needed to support C++ exceptions. Compilation only.

‑fomit‑frame‑pointer,

‑fno‑omit‑frame‑pointer

Enables or disables the storage of stack frame pointers during function calls. Compilation only.
‑fno‑builtin Disables special handling and optimizations of standard C library functions. Compilation only.

‑fpic,

‑fno‑pic

Enables or disables the generation of position-independent code with relative address references, which are independent of the location where your program is loaded. Compilation only.

‑fropi,

‑fno‑ropi

Enables or disables the generation of Read-Only Position-Independent (ROPI) code. Compilation only.

‑fropi‑lowering,

‑fno‑ropi‑lowering

Enables or disables runtime static initialization when generating Read-Only Position-Independent (ROPI) code. Compilation only.

‑frwpi,

‑fno‑rwpi

Enables or disables the generation of Read-Write Position-Independent (RWPI) code. Compilation only.

‑frwpi‑lowering,

‑fno‑rwpi‑lowering

Enables or disables runtime static initialization when generating Read-Write Position-Independent (RWPI) code. Compilation only.
‑fsanitize [ALPHA] Selects the sanitizer option used in code generation. Compilation only.

‑fshort‑enums,

‑fno‑short‑enums

Allows or disallows the compiler to set the size of an enumeration type to the smallest data type that can hold all enumerator values. Compilation only.

‑fshort‑wchar,

‑fno‑short‑wchar

Sets the size of wchar_t to 2 or 4 bytes. Compilation only.
‑fstack‑protector, ‑fstack‑protector‑strong, ‑fstack‑protector‑all, ‑fno‑stack‑protector Inserts a guard variable onto the stack frame for each vulnerable function or for all functions. Compilation only.

‑fstrict‑aliasing,

‑fno‑strict‑aliasing

Instructs the compiler to apply or not apply the strictest aliasing rules available. Compilation only.

‑fsysv,

‑fno‑sysv

Enables or disables the generation of code suitable for the SysV linking model. Compilation only.

‑fvectorize,

‑fno‑vectorize

Enables or disables the generation of Advanced SIMD vector instructions directly from C or C++ code at optimization levels ‑O1 and higher.

Enables or disables the generation of MVE instructions directly from C or C++ code at optimization levels ‑O1 and higher. The use of ‑fvectorize for MVE vectorization is a [BETA] support feature.

Compilation only.
‑ftrapv Instructs the compiler to generate traps for signed arithmetic overflow on addition, subtraction, and multiplication operations. Compilation only.
‑fwrapv Instructs the compiler to assume that signed arithmetic overflow of addition, subtraction, and multiplication, wraps using two's-complement representation. Compilation only.

‑g,

‑gdwarf‑2,

‑gdwarf‑3,

‑gdwarf‑4

Adds debug tables for source-level debugging. Compilation and assembly.
‑I Adds the specified directory to the list of places that are searched to find include files. Compilation and assembly.
‑include Includes the source code of the specified file at the beginning of the compilation. Compilation only.
‑L Specifies a list of paths that the linker searches for user libraries. Compilation only.
‑l Add the specified library to the list of searched libraries. Compilation only.

‑M,

‑MM

Produces a list of makefile dependency rules suitable for use by a make utility. Compilation and assembly.

‑MD,

‑MMD

Compiles or assembles source files and produces a list of makefile dependency rules suitable for use by a make utility. Compilation and assembly.
‑MF Specifies a filename for the makefile dependency rules produced by the ‑M and ‑MD options. Compilation only.
‑MG Prints dependency lines for header files even if the header files are missing. Compilation only.
‑MP Emits dummy dependency rules that work around make errors that are generated if you remove header files without a corresponding update to the makefile. Compilation only.
‑MT Changes the target of the makefile dependency rule produced by dependency generating options. Compilation and assembly.
‑march Targets an architecture profile, generating generic code that runs on any processor of that architecture. Compilation and assembly.
‑marm Requests that the compiler targets the A32 instruction set. Compilation only.
‑masm Selects the correct assembler for the input assembly source files. Compilation and assembly.
‑mbig‑endian Generates code suitable for an Arm processor using byte-invariant big-endian (BE‑8) data. Compilation and assembly.
‑mbranch‑protection Protects branches using Pointer Authentication and Branch Target Identification. Compilation only.
‑mcmodel Selects the generated code model. Compilation only.
‑mcmse Enables the generation of code for the Secure state of the Armv8‑M Security Extensions. Compilation only.
‑mcpu Targets a specific processor, generating optimized code for that specific processor. Compilation and assembly.
‑mexecute‑only Generates execute-only code, and prevents the compiler from generating any data accesses to code sections. Compilation only.
‑mfloat‑abi Specifies the following:
  • Whether to use hardware instructions or software library functions for floating-point operations.
  • Which registers are used to pass floating-point parameters and return values.
Compilation and assembly.
‑mfpu Specifies the target FPU architecture, that is the floating-point hardware available on the target. Compilation and assembly.
‑mimplicit‑it Specifies the behavior of the integrated assembler if there are conditional instructions outside IT blocks. Compilation and assembly.
‑mlittle‑endian Generates code suitable for an Arm processor using little-endian data. Compilation and assembly.
‑mno‑neg‑immediates Disables the substitution of invalid instructions with valid equivalent instructions that use the logical inverse or negative of the specified immediate value. Compilation and assembly.

‑moutline,

‑mno‑outline

Puts identical sequences of code into a separate function. Compilation only.
‑mpixolib Generates a Position Independent eXecute Only (PIXO) library. Compilation only.

‑munaligned‑access,

‑mno‑unaligned‑access

Enables or disables unaligned accesses to data on Arm processors. Compilation only.
‑mthumb Requests that the compiler targets the T32 instruction set. Compilation only.
‑o Specifies the name of the output file. Compilation and assembly.
‑O Specifies the level of optimization to use when compiling source files. Compilation only.
-pedantic Generate warnings if code violates strict ISO C and ISO C++. Compilation only.
-pedantic-errors Generate errors if code violates strict ISO C and ISO C++. Compilation only.
‑Rpass [COMMUNITY] Outputs remarks from the optimization passes made by armclang. You can output remarks for all optimizations, or remarks for a specific optimization. Compilation only.
‑S Outputs the disassembly of the machine code generated by the compiler. Compilation only.
‑save‑temps Instructs the compiler to generate intermediate assembly files from the specified C/C++ file. Compilation only.
‑shared Creates a System V (SysV) shared object. Compilation only.
‑std Specifies the language standard to compile for. Compilation only.
‑‑target Generate code for the specified target triple. Compilation and assembly.
‑U Removes any initial definition of the specified preprocessor macro. Compilation only.
‑u Prevents the removal of a specified symbol if it is undefined. Compilation and assembly.
‑v Displays the commands that invoke the compiler and sub-tools, such as armlink, and executes those commands. Compilation and assembly.
‑‑version Displays the same information as ‑‑vsn. Compilation and assembly.
‑‑version_number Displays the version of armclang you are using. Compilation and assembly.
‑‑vsn Displays the version information and the license details. Compilation and assembly.
‑W Controls diagnostics. Compilation only.
‑Wl Specifies linker command-line options to pass to the linker when a link step is being performed after compilation. Compilation only.
‑Xlinker Specifies linker command-line options to pass to the linker when a link step is being performed after compilation. Compilation only.
‑x Specifies the language of source files. Compilation and assembly.
‑### Displays the commands that invoke the compiler and sub-tools, such as armlink, without executing those commands. Compilation and assembly.
Non-ConfidentialPDF file icon PDF version101754_0613_00_en
Copyright © 2019 Arm Limited or its affiliates. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.