9.12 AArch32 Target selection directives

The AArch32 target selection directives specify code generation parameters for AArch32 targets.

Syntax

.arm
.thumb
.arch arch_name
.cpu cpu_name
.fpu fpu_name
.arch_extension extension_name
.eabi_attribute tag, value

Description

.arm

The .arm directive instructs the assembler to interpret subsequent instructions as A32 instructions, using the UAL syntax.

The .code 32 directive is an alias for .arm.

.thumb

The .thumb directive instructs the assembler to interpret subsequent instructions as T32 instructions, using the UAL syntax.

The .code 16 directive is an alias for .thumb.

.arch

The .arch directive changes the architecture that the assembler is generating instructions for. The arch_name argument accepts the same names as the -march option, but does not accept the optional architecture extensions accepted by the command-line option.

.cpu

The .cpu directive changes the CPU that the assembler is generating instructions for. The cpu_name argument accepts the same names as the -mcpu option, but does not accept the optional architecture extensions accepted by the command-line option.

.fpu

The .fpu directive changes the FPU that the assembler is generating instructions for. The fpu_name argument accepts the same names as the -mfpu option.

.arch_extension

The .arch_extension enables or disables optional extensions to the architecture or CPU that the assembler is generating instructions for. It accepts the following optional extensions, which can be prefixed with no to disable them:

  • crc
  • fp16
  • ras
.eabi_attribute

The .eabi_attribute directive sets a build attribute in the output file. Build attributes are used by armlink to check for co-compatibility between object files, and to select suitable libraries.

The .eabi_attribute directive does not have any effect on which instructions the assembler will accept. It is recommended that the .arch, .cpu, .fpu and .arch_extension directives are used where possible, as they also check that no instructions not valid for the selected architecture are valid. These directives also set the relevant build attributes, so the .eabi_attribute directive is only needed for attributes not covered by them.

tag

The tag argument specifies the tag that is to be set. This can either be the tag name or tag number, but not both.

value

The value argument specifies the value to set for the tag. The value can either be of integer or string type. The type must match exactly the type expected for that tag.

Note:

Tag_compatibility is a special tag that requires both an integer value and a string value:

.eabi_attribute Tag_compatibility, integer_value, string_value

Examples

  // Generate code for the Armv7-M architecture:
  .arch armv7-m

  // Generate code for the Cortex-R5, without an FPU:
  .cpu cortex-r5
  .fpu none

  // Generate code for Armv8.2-A with the FP16 extension:
  .arch armv8.2-a
  .fpu neon-fp-armv8
  .arch_extension fp16
Non-ConfidentialPDF file icon PDF versionDUI0774J
Copyright © 2014–2017, 2019 Arm Limited or its affiliates. All rights reserved.