| |||
| Home > Directives Reference > Miscellaneous directives > REQUIRE8 and PRESERVE8 | |||
The REQUIRE8 directive specifies that the current
file requires eight-byte alignment of the stack. It sets the REQ8
build attribute to inform the linker.
The PRESERVE8 directive specifies that the current
file preserves eight-byte alignment of the stack. It sets the PRES8
build attribute to inform the linker.
The linker checks that any code that requires eight-byte alignment of the stack is only called, directly or indirectly, by code that preserves eight-byte alignment of the stack.
REQUIRE8 {bool}
PRESERVE8 {bool}
where:
boolis an optional Boolean constant, either {TRUE} or {FALSE}.
Where required, if your code preserves eight-byte alignment
of the stack, use PRESERVE8 to set the PRES8 build
attribute on your file. If your code does not preserve eight-byte
alignment of the stack, use PRESERVE8 {FALSE} to ensure
that the PRES8 build attribute is not set. If there are multiple REQUIRE8 or PRESERVE8 directives
in a file, the assembler uses the value of the last directive.
If you omit both PRESERVE8 and PRESERVE8
{FALSE}, the assembler decides whether to set the PRES8 build
attribute or not, by examining instructions that modify the SP.
ARM recommends that you specify PRESERVE8 explicitly.
You can enable a warning with:
armasm --diag_warning 1546
This gives you warnings like:
"test.s", line 37: Warning: A1546W: Stack pointer update potentially
breaks 8 byte stack alignment
37 00000044 STMFD sp!,{r2,r3,lr}
REQUIRE8
REQUIRE8 {TRUE} ; equivalent to REQUIRE8
REQUIRE8 {FALSE} ; equivalent to absence of REQUIRE8
PRESERVE8 {TRUE} ; equivalent to PRESERVE8
PRESERVE8 {FALSE} ; NOT exactly equivalent to absence of PRESERVE8