[PATCH] Add gcc ARM flags -munaligned-access / -mno-unaligned-access

Jeroen Hofstee clang at myspectrum.nl
Sat Aug 17 01:46:40 PDT 2013


Hello,

In commit [1] mstrict-align is added as a cc1 option for ARM.
"Force all memory accesses to be aligned. (ARM only)"

GCC has this flag, but only for powerpc, which states:
"On System V.4 and embedded PowerPC systems do not (do)
assume that unaligned memory references are handled by
the system. "

On ARM gcc supports the -munaligned-access / -mno-unaligned-access,
flags, which I am looking for:

"Enables (or disables) reading and writing of 16- and 32- bit
values from addresses that are not 16- or 32- bit aligned.
By default unaligned access is disabled for all pre-ARMv6
and all ARMv6-M architectures, and enabled for all other
architectures. If unaligned access is not enabled then
words in packed data structures will be accessed a byte
at a time."

I am not sure if there are subtle differences between these.
Attached patch assumes they are exactly the same and adds
the gcc flags while preserving the cc1 as well.

This patch depends on the -ffixed-r9 patch for creating the
ARM specific group.

Regards,
Jeroen

[1] http://llvm.org/viewvc/llvm-project?view=revision&revision=167619
[2] 
http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/RS_002f6000-and-PowerPC-Options.html#RS_002f6000-and-PowerPC-Options
[3] http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/ARM-Options.html#ARM-Options
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-add-mno-unaligned.patch
Type: text/x-patch
Size: 3486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130817/4b83fe5b/attachment.bin>


More information about the cfe-commits mailing list