1.43 -mthumb

Requests that the compiler targets the T32 or Thumb® instruction sets.

Most ARMv7-A (and earlier) processors support two instruction sets: the ARM instruction set, and the Thumb instruction set. ARMv8-A AArch32 continues to support these two instruction sets, but they are renamed as A32 and T32 respectively. ARMv8-A additionally introduces the A64 instruction set, used in the AArch64 execution state.
Different architectures support different instruction sets:
  • ARMv8-A processors in AArch64 state execute A64 instructions.
  • ARMv8-A processors in AArch32 state, in addition to ARMv7 and earlier A- and R- profile processors execute A32 (formerly ARM) and T32 (formerly Thumb) instructions.
  • M-profile processors execute T32 (formerly Thumb) instructions.
The -mthumb option targets the T32 (formerly Thumb) instruction set.

Note

  • The -mthumb option is not valid with AArch64 targets, for example --target=aarch64-arm-none-eabi. The compiler ignores the -mthumb option and generates a warning with AArch64 targets.
  • The -mthumb option is recognized when using armclang as a compiler, but not when using it as an assembler. To request armclang to assemble using the T32 or Thumb instruction set for your assembly source files, you must use the .thumb or .code 16 directive in the assembly files.

Default

The default for all targets that support ARM or A32 instructions is -marm.

Example

armclang -c --target=arm-arm-none-eabi -march=armv8-a -mthumb test.c
Related reference
1.34 -marm
1.48 --target
1.37 -mcpu
Related information
Specifying a target architecture, processor, and instruction set
Assembling ARM and GNU syntax assembly code
Non-ConfidentialPDF file icon PDF versionARM DUI0774E
Copyright © 2014-2016 ARM. All rights reserved.