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

Predefined macros

B6.2 Predefined macros

The Arm® Compiler predefines a number of macros. These macros provide information about toolchain version numbers and compiler options.

In general, the predefined macros generated by the compiler are compatible with those generated by GCC. See the GCC documentation for more information.

The following table lists Arm-specific macro names predefined by the Arm compiler for C and C++, together with a number of the most commonly used macro names. Where the value field is empty, the symbol is only defined.

Note:

Use -E -dM to see the values of predefined macros.

Macros beginning with __ARM_ are defined by the Arm® C Language Extensions 2.0 (ACLE 2.0).

Note:

armclang does not fully implement ACLE 2.0.

Table B6-1 Predefined macros

Name Value When defined
__APCS_ROPI 1

Set when you specify the -fropi option.

__APCS_RWPI 1

Set when you specify the -frwpi option.

__ARM_64BIT_STATE 1

Set for targets in AArch64 state only.

Set to 1 if code is for 64-bit state.

__ARM_ALIGN_MAX_STACK_PWR 4

Set for targets in AArch64 state only.

The log of the maximum alignment of the stack object.

__ARM_ARCH ver

Specifies the version of the target architecture, for example 8.

__ARM_ARCH_EXT_IDIV__ 1

Set for targets in AArch32 state only.

Set to 1 if hardware divide instructions are available.

__ARM_ARCH_ISA_A64 1

Set for targets in AArch64 state only.

Set to 1 if the target supports the A64 instruction set.

__ARM_ARCH_PROFILE ver

Specifies the profile of the target architecture, for example 'A'.

__ARM_BIG_ENDIAN - Set if compiling for a big-endian target.
__ARM_FEATURE_CLZ 1

Set to 1 if the CLZ (count leading zeroes) instruction is supported in hardware.

__ARM_FEATURE_CMSE num

Indicates the availability of the Armv8‑M Security Extension related extensions:

0
The Armv8‑M TT instruction is not available.
1
The TT instruction is available. It is not part of Armv8‑M Security Extension, but is closely related.
3
The Armv8‑M Security Extension for secure executable files is available. This implies that the TT instruction is available.

See B6.9 TT instruction intrinsics for more information.

__ARM_FEATURE_CRC32 1

Set to 1 if the target has CRC extension.

__ARM_FEATURE_CRYPTO 1

Set to 1 if the target has cryptographic extension.

__ARM_FEATURE_DIRECTED_ROUNDING 1 Set to 1 if the directed rounding and conversion vector instructions are supported.

Only available when __ARM_ARCH >= 8.

__ARM_FEATURE_DSP 1

Set for targets in AArch32 state only.

Set to 1 if DSP instructions are supported. This feature also implies support for the Q flag.

Note:

This macro is deprecated in ACLE 2.0 for A-profile. It is fully supported for M and R-profiles.
__ARM_FEATURE_IDIV 1 Set to 1 if the target supports 32-bit signed and unsigned integer division in all available instruction sets.
__ARM_FEATURE_FMA 1

Set to 1 if the target supports fused floating-point multiply-accumulate.

__ARM_FEATURE_NUMERIC_MAXMIN 1

Set to 1 if the target supports floating-point maximum and minimum instructions.

Only available when __ARM_ARCH >= 8.

__ARM_FEATURE_QBIT 1

Set for targets in AArch32 state only.

Set to 1 if the Q (saturation) flag exists.

Note:

This macro is deprecated in ACLE 2.0 for A-profile.
__ARM_FEATURE_SAT 1

Set for targets in AArch32 state only.

Set to 1 if the SSAT and USAT instructions are supported. This feature also implies support for the Q flag.

Note:

This macro is deprecated in ACLE 2.0 for A-profile.
__ARM_FEATURE_SIMD32 1

Set for targets in AArch32 state only.

Set to 1 if the target supports 32-bit SIMD instructions.

Note:

This macro is deprecated in ACLE 2.0 for A-profile, use Arm Neon™ intrinsics instead.
__ARM_FEATURE_UNALIGNED 1

Set to 1 if the target supports unaligned access in hardware.

__ARM_FP val

Set if hardware floating-point is available.

Bits 1-3 indicate the supported floating-point precision levels. The other bits are reserved.

  • Bit 1 - half precision (16-bit).
  • Bit 2 - single precision (32-bit).
  • Bit 3 - double precision (64-bit).

These bits can be bitwise or-ed together. Permitted values include:

  • 0x04 for single-support.
  • 0x0C for single- and double-support.
  • 0x0E for half-, single-, and double-support.
__ARM_FP_FAST 1

Set if ‑ffast‑math or ‑ffp‑mode=fast is specified.

__ARM_NEON 1

Set to 1 when the compiler is targeting an architecture or processor with Advanced SIMD available.

Use this macro to conditionally include arm_neon.h, to permit the use of Advanced SIMD intrinsics.

__ARM_NEON_FP val

This is the same as __ARM_FP, except that the bit to indicate double-precision is not set for targets in AArch32 state. Double-precision is always set for targets in AArch64 state.

__ARM_PCS 1

Set for targets in AArch32 state only.

Set to 1 if the default procedure calling standard for the translation unit conforms to the base PCS.

__ARM_PCS_VFP 1

Set for targets in AArch32 state only.

Set to 1 if the default procedure calling standard for the translation unit conforms to the VFP PCS. That is, -mfloat-abi=hard.

__ARM_SIZEOF_MINIMAL_ENUM value

Specifies the size of the minimal enumeration type. Set to either 1 or 4 depending on whether -fshort-enums is specified or not.

__ARM_SIZEOF_WCHAR_T value

Specifies the size of wchar in bytes.

Set to 2 if -fshort-wchar is specified, or 4 if -fno-short-wchar is specified.

Note:

The default size is 4, because -fno-short-wchar is set by default.
__ARMCOMPILER_VERSION Mmmuuxx

Always set. Specifies the version number of the compiler, armclang.

The format is Mmmuuxx, where:

  • M is the major version number, 6.
  • mm is the minor version number.
  • uu is the update number.
  • xx is reserved for Arm internal use. You can ignore this for the purposes of checking whether the current release is a specific version or within a range of versions.

For example, version 6.3 update 1 is displayed as 6030154, where 54 is a number for Arm internal use.

__ARMCC_VERSION Mmmuuxx

A synonym for __ARMCOMPILER_VERSION.

__arm__ 1

Defined when targeting AArch32 state with --target=arm-arm-none-eabi.

See also __aarch64__.

__aarch64__ 1

Defined when targeting AArch64 state with --target=aarch64-arm-none-eabi.

See also __arm__.

__cplusplus ver

Defined when compiling C++ code, and set to a value that identifies the targeted C++ standard. For example, when compiling with -xc++ -std=gnu++98, the compiler sets this macro to 199711L.

You can use the __cplusplus macro to test whether a file was compiled by a C compiler or a C++ compiler.

__CHAR_UNSIGNED__ 1 Defined if and only if char is an unsigned type.
__EXCEPTIONS 1

Defined when compiling a C++ source file with exceptions enabled.

__GNUC__ ver Always set. An integer that specifies the major version of the compatible GCC version. This macro indicates that the compiler accepts GCC compatible code. The macro does not indicate whether the -std option has enabled GNU C extensions. For detailed Arm Compiler version information, use the __ARMCOMPILER_VERSION macro.
__INTMAX_TYPE__ type Always set. Defines the correct underlying type for the intmax_t typedef.
__NO_INLINE__ 1

Defined if no functions have been inlined. The macro is always defined with optimization level -O0 or if the -fno-inline option is specified.

__OPTIMIZE__ 1

Defined when -O1, -O2, -O3, -Ofast, -Oz, or -Os is specified.

__OPTIMIZE_SIZE__ 1

Defined when -Os or -Oz is specified.

__PTRDIFF_TYPE__ type Always set. Defines the correct underlying type for the ptrdiff_t typedef.
__SIZE_TYPE__ type Always set. Defines the correct underlying type for the size_t typedef.
__SOFTFP__ 1

Set to 1 when compiling with -mfloat-abi=softfp for targets in AArch32 state.

Set to 0 otherwise.

__STDC__ 1 Always set. Signifies that the compiler conforms to ISO Standard C.
__STRICT_ANSI__ 1

Defined if you specify the --ansi option or specify one of the --std=c* options .

__thumb__ 1

Defined if you specify the -mthumb option.

__UINTMAX_TYPE__ type Always set. Defines the correct underlying type for the uintmax_t typedef.
__VERSION__ ver

Always set. A string that shows the underlying Clang version.

__WCHAR_TYPE__ type Always set. Defines the correct underlying type for the wchar_t typedef.
__WINT_TYPE__ type Always set. Defines the correct underlying type for the wint_t typedef.
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.