8.4.4 ARM Machine Directives
-
.align
expression[,
expression]
- This is the generic .align directive. For the ARM however if the first argument is zero (ie no alignment is needed) the assembler will behave as if the argument had been 2 (ie pad to the next four byte boundary). This is for compatibility with ARM's own assembler.
-
name
.req
register name -
This creates an alias for register name called name. For example:
foo .req r0
-
.unreq
alias-name -
This undefines a register alias which was previously defined using the
req
directive. For example:foo .req r0 .unreq foo
An error occurs if the name is undefined. Note - this pseudo op can be used to delete builtin in register name aliases (eg 'r0'). This should only be done if it is really necessary.
-
.code [16|32]
- This directive selects the instruction set being generated. The value 16 selects Thumb, with the value 32 selecting ARM.
-
.thumb
- This performs the same action as .code 16.
-
.arm
- This performs the same action as .code 32.
-
.force_thumb
- This directive forces the selection of Thumb instructions, even if the target processor does not support those instructions
-
.thumb_func
-
This directive specifies that the following symbol is the name of a Thumb encoded function. This information is necessary in order 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. The presence of this directive also implies
.thumb
-
.thumb_set
-
This performs the equivalent of a
.set
directive in that it creates a symbol which is an alias for another symbol (possibly not yet defined). This directive also has the added property in that it marks the aliased symbol as being a thumb function entry point, in the same way that the.thumb_func
directive does. -
.ltorg
-
This directive causes the current contents of the literal pool to be 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. The.ltorg
directive will only affect 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.Note - older versions of
GAS
would dump the current literal pool any time a section change occurred. This is no longer done, since it prevents accurate control of the placement of literal pools. -
.pool
- This is a synonym for .ltorg.
-
.unwind_fnstart
- Marks the start of a function with an unwind table entry.
-
.unwind_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.
-
.cantunwind
- Prevents unwinding through the current function. No personality routine or exception table data is required or permitted.
-
.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 the
.fnend
directive will be added to the exception table entry.Must be preceded by a
.personality
or.personalityindex
directive. -
.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} fstmdf 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]! -
.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.
-
.movsp
reg - Tell the unwinder that reg contains the current stack pointer.
-
.setfp
fpreg,
spreg[, #
offset]
-
Make all unwinder annotations relaive to a frame pointer. Without this the unwinder will use offsets from the stack pointer.
The syntax of this directive is the same as the
sub
ormov
instruction used to set the frame pointer. spreg must be eithersp
or mentioned in a previous.movsp
directive..movsp ip mov ip, sp ... .setfp fp, ip, #4 sub fp, ip, #4
-
.raw
offset,
byte1, ...
-
Insert one of more arbitary 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}