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

JF Bastien jfb at google.com
Mon Aug 19 08:54:59 PDT 2013


For completeness, the default behavior is in ARMSubtarget.cpp:
      // Assume pre-ARMv6 doesn't support unaligned accesses.
      //
      // ARMv6 may or may not support unaligned accesses depending on the
      // SCTLR.U bit, which is architecture-specific. We assume ARMv6
      // Darwin targets support unaligned accesses, and others don't.
      //
      // ARMv7 always has SCTLR.U set to 1, but it has a new SCTLR.A bit
      // which raises an alignment fault on unaligned accesses. Linux
      // defaults this bit to 0 and handles it as a system-wide (not
      // per-process) setting. It is therefore safe to assume that ARMv7+
      // Linux targets support unaligned accesses. The same goes for NaCl.
      //
      // The above behavior is consistent with GCC.

The change lgtm.


On Sun, Aug 18, 2013 at 6:15 AM, Renato Golin <renato.golin at linaro.org>wrote:

> On 18 August 2013 08:17, Jeroen Hofstee <clang at myspectrum.nl> wrote:
>
>> If I make -munaligned-access a dummy (at least that what
>> I guess you mean), there is no proper way to allow unaligned
>> accesses on say one of the BSDs or e.g. armv6 and linux.
>> Both flags are needed to control alignment behaviour in general.
>>
>
> Good point. LGTM.
>
> --renato
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130819/fa4d8c4f/attachment.html>


More information about the cfe-commits mailing list