9.4.4 ARM Machine Directives

GNU as aka GAS Similar to the ARM corporation's assembler
.align expression [, expression] if the first argument is zero (ie no alignment is needed) behave as if the argument had been 2 (ie pad to the next four byte boundary).
.arch name Select the target architecture. values as for -march
.arch_extension name Add or remove an architecture extension to the target architecture. values as those accepted as architectural extensions by -mcpu May be used multiple times to add or remove extensions
.thumb
.code 16.

.arm
.code 32
.

selects the instruction set being generated.
.bss switches to the .bss section.
.cantunwind Prevents unwinding through the current function. No personality routine or exception table data is required or permitted.
.cpu name Select the target processor. values as for -mcpu
name .req registerName creates an alias for registerName> . For example:
 foo .req r0
name .dn registerName [.type] [[index]]
name .qn registerName [.type] [[index]]
create typed and/or indexed register aliases for use in Advanced SIMD Extension instructions.
.dn create aliases of double-precision registers,
.qn create aliases of quad-precision registers.
These aliases can be used in Neon instructions avoiding specifying type after the mnemonic or after each operand. For example:
 x .dn d2.f32
 y .dn d3.f32
 z .dn d4.f32[1]

 vmul x,y,z
is equivalent to :
 vmul.f32 d2,d3,d4[1]
.unreq alias Undefines a register alias defined using req, dn or qn.
.eabi_attribute tag, value Set the EABI object attribute tag to value. tag is either an attribute number, or one of: Tag_CPU_raw_name, Tag_CPU_name, Tag_CPU_arch, Tag_CPU_arch_profile, Tag_ARM_ISA_use, Tag_THUMB_ISA_use, Tag_FP_arch, Tag_WMMX_arch, Tag_Advanced_SIMD_arch, Tag_PCS_config, Tag_ABI_PCS_R9_use, Tag_ABI_PCS_RW_data, Tag_ABI_PCS_RO_data, Tag_ABI_PCS_GOT_use, Tag_ABI_PCS_wchar_t, Tag_ABI_FP_rounding, Tag_ABI_FP_denormal, Tag_ABI_FP_exceptions, Tag_ABI_FP_user_exceptions, Tag_ABI_FP_number_model, Tag_ABI_align_needed, Tag_ABI_align_preserved, Tag_ABI_enum_size, Tag_ABI_HardFP_use, Tag_ABI_VFP_args, Tag_ABI_WMMX_args, Tag_ABI_optimization_goals, Tag_ABI_FP_optimization_goals, Tag_compatibility, Tag_CPU_unaligned_access, Tag_FP_HP_extension, Tag_ABI_FP_16bit_format, Tag_MPextension_use, Tag_DIV_use, Tag_nodefaults, Tag_also_compatible_with, Tag_conformance, Tag_T2EE_use, Tag_Virtualization_use
Legacy values include: Tag_VFP_arch, Tag_ABI_align8_needed, Tag_ABI_align8_preserved, Tag_VFP_HP_extension,

value is either a number, "string", or number, "string" depending on the tag.

.even aligns to an even-numbered address.
.extend expression [, expression]*
.ldouble expression [, expression]*
write 12byte long double floating-point values to the output section. not compatible with current ARM processors or ABIs.
.packed expression [, expression]* writes 12-byte packed floating-point values to the output section. not compatible with current ARM processors or ABIs.
.fnstart Marks the start of a function with an unwind table entry.
.fnend Marks the end of a function with an unwind table entry. The unwind index table entry is created when this directive is processed.
If no personality routine has been specified then standard personality routine 0 or 1 will be used, depending on the number of unwind opcodes required.
.personality name Sets the personality routine for the current function to name
.personalityindex index Sets the personality routine for the current function to the EABI standard routine number index
.handlerdata Marks the end of the current function, and the start of the exception table entry for that function.
Anything between this directive and .fnend will be added to the exception table entry.
Must be preceded by a .personality or .personalityindex directive.
.inst opcode [ , … ]
.inst.n opcode [ , … ]
.inst.w opcode [ , … ]
Generates the instruction corresponding to the numerical value opcode.
.inst.n and .inst.w allow the Thumb instruction size to be specified explicitly, overriding the normal encoding rules.
.force_thumb forces the selection of Thumb instructions
.fpu name Select the floating-point unit to assemble for. values as for -mfpu
.ltorg
.pool
literal pool is dumped into the current section (which is assumed to be the .text section) at the current location (aligned to a word boundary). GAS maintains a separate literal pool for each section and each sub-section.
Affects the literal pool of the current section and sub-section.
At the end of assembly all remaining, un-empty literal pools will automatically be dumped.
.movsp reg [, #offset] Tell the unwinder that reg contains an offset from the current stack pointer.
Default offset is 0.
.object_arch name Override the architecture recorded in the EABI object attribute section. name as .arch .
useful when code uses runtime detection of CPU features.
.pad count Generate unwinder annotations for a stack adjustment of count bytes.
A positive value indicates the function prologue allocated stack space by decrementing the stack pointer.
.save reglist Generate unwinder annotations to restore the registers in reglist.
The format of reglist is the same as the corresponding store-multiple instruction.
core registers
  .save {r4, r5, r6, lr}
  stmfd sp!, {r4, r5, r6, lr}
FPA registers
  .save f4, 2
  sfmfd f4, 2, [sp]!
 VFP registers
  .save {d8, d9, d10}
  fstmdx sp!, {d8, d9, d10}
iWMMXt registers
  .save {wr10, wr11}
  wstrd wr11, [sp, #-8]!
  wstrd wr10, [sp, #-8]!
or
  .save wr11
  wstrd wr11, [sp, #-8]!
  .save wr10
  wstrd wr10, [sp, #-8]!
.vsave vfp-reglist Generate unwinder annotations to restore the VFP registers in vfp-reglist using FLDMD.
Also for VFPv3 registers that are to be restored using VLDM.
The format of vfp-reglist is the same as the corresponding store-multiple instruction.
VFP registers
  .vsave {d8, d9, d10}
  fstmdd sp!, {d8, d9, d10}
VFPv3 registers
  .vsave {d15, d16, d17}
  vstm sp!, {d15, d16, d17}
FLDMX and FSTMX are deprecated, this directive should be used in favour of .save for saving VFP registers for ARMv6 and above.
.setfp fpreg, spreg [, #offset] Make all unwinder annotations relative to a frame pointer.
Default use offsets from the stack pointer.

The syntax of this directive is the same as the add or mov instruction used to set the frame pointer.
spreg must be either sp or mentioned in a previous .movsp directive.

.movsp ip
mov ip, sp
…
.setfp fp, ip, #4
add fp, ip, #4

.secrel32 expression [, expression]* emits relocations that evaluate to the section-relative offset of each expression's symbol.
Only for PE targets.
.syntax [unified | divided] sets the Instruction Set Syntax as described in the ARM-Instruction-Set section.
.thumb_func specifies that the following symbol is the name of a Thumb encoded function.
Necessary to allow the assembler and linker to generate correct code for interworking between Arm and Thumb instructions and should be used even if interworking is not going to be performed. implies .thumb

Not necessary when generating EABI objects. On these targets the encoding is implicit when generating Thumb code.

.thumb_set performs the equivalent of a .set in that it creates a symbol which is an alias for another symbol (possibly not yet defined).
Marks the aliased symbol as being a thumb function entry point
.tlsdescseq tls-variable annotate parts of an inlined TLS (Thread-Local Storage Descriptors) descriptor trampoline.
Normally the trampoline is provided by the linker, and this directive is not needed.
.unwind_raw offset, byte1, … Insert one of more arbitrary unwind opcode bytes, which are known to adjust the stack pointer by offset bytes. For example
.unwind_raw 4, 0xb1, 0x01 
is equivalent to
.save {r0}
Adapted from sourceWare

ARM instructions