This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: always default to -mno-unaligned-access for bare-metal ARM


Recently I tracked down a target crash problem in an ARM EABI configuration running on a Cortex-A9 board to an unaligned access fault. The startup code provided by the customer for this board doesn't enable the MMU, and unaligned access support requires the MMU to be enabled per

http://infocenter.arm.com/help/topic/com.arm.doc.faqs/ka13671.html

The GCC manual presently says "By default unaligned access is disabled for all pre-ARMv6 and all ARMv6-M architectures, and enabled for all other architectures." I think it would be safer for GCC to default to -maligned-access only in configurations that are known also to enable the MMU, e.g. GNU/Linux. Code being built for bare-metal ARM EABI targets typically includes low-level startup code and boot loaders that run before the MMU is enabled, and likewise I don't think RTEMS, uCLinux, etc imply MMU support, either.

We could tell all ARM EABI users to build with -mno-unaligned-access, but if multilibs for (say) -march=armv7-a are being provided then those must also be built with the "safe" setting to avoid crashes in e.g. the Newlib memcpy implementation. I think it would be more user-friendly just to change the default.

ARM maintainers, WDYT? I will work up and test a patch if there is agreement that this is a reasonable thing to do.

-Sandra


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]