| |||
Home > Compiler Command-line Options > Command-line options > ‑‑[no_]unaligned_access |
This option enables or disables unaligned accesses to data on ARM architecture-based processors.
The default is --unaligned_access
on ARM-architecture
based processors that support unaligned accesses to data. This includes:
all ARMv6 architecture-based processors
ARMv7-A and ARMv7-R architecture-based processors.
The default is --no_unaligned_access
on ARM-architecture
based processors that do not support unaligned accesses to data.
This includes:
all pre-ARMv6 architecture-based processors
ARMv7-M architecture-based processors.
--unaligned_access
Use --unaligned_access
on processors
that support unaligned accesses to data, for example --cpu=ARM1136J-S
,
to speed up accesses to packed structures.
To enable unaligned support, you must:
Clear the A
bit, bit 1, of CP15 register
1 in your initialization code.
Set the U
bit, bit 22, of CP15
register 1 in your initialization code.
The initial value of the U
bit is determined
by the UBITINIT input to the
core.
The RVCT libraries include special versions of certain library functions designed to exploit unaligned accesses. When unaligned access support is enabled, the RVCT tools use these library functions to take advantage of unaligned accesses.
--no_unaligned_access
Use --no_unaligned_access
to disable
the generation of unaligned word and halfword accesses on ARMv6
processors.
To enable modulo four-byte alignment checking on an ARMv6 target without unaligned accesses, you must:
Set the A
bit, bit 1, of CP15 register
1 in your initialization code.
Set the U
bit, bit 22, of CP15
register 1 in your initialization code.
The initial value of the U
bit is determined
by the UBITINIT input to the
core.
Unaligned doubleword accesses, for example unaligned accesses to long long integers, are not supported by ARM processor cores. Doubleword accesses must be either eight-byte or four-byte aligned.
The compiler does not provide support for modulo eight-byte
alignment checking. That is, the configuration U = 0
, A
= 1
in CP15 register 1 is not supported by the compiler,
or more generally, by the RVCT toolset.
The RVCT libraries include special versions of certain library
functions designed to exploit unaligned accesses. To prevent these
enhanced library functions being used when unaligned access support
is disabled, you need to specify --no_unaligned_access
on
both the compiler command line and the assembler command line when
compiling a mixture of C and C++ source files and asssembly language
source files.
Code compiled for processors supporting unaligned accesses to data can run correctly only if the choice of alignment support in software matches the choice of alignment support on the processor core.
Command syntax in the Assembler Guide
Alignment support in the Compiler User Guide.