summaryrefslogtreecommitdiffstats
path: root/arch/arm/Makefile
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2015-10-11 11:43:35 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2015-10-15 08:56:21 +0200
commit4ef026c30483a724bd577bf739e1da2474bc1001 (patch)
tree982efdb3cee45b6f9ccb4d23fa76b3bae51ba83e /arch/arm/Makefile
parent93fc1f1a1a58249c1811bc320975792e900580ea (diff)
downloadbarebox-4ef026c30483a724bd577bf739e1da2474bc1001.tar.gz
barebox-4ef026c30483a724bd577bf739e1da2474bc1001.tar.xz
arm: Disable unaligned accesses
From reading ARM architecture related documentation if appears that while unaligned memory access is supported by the processor in general it is not supported if MMU is disabled. The problem in question can be easily reproduced by building the code without this patch, MMU disabled, and trying to run 'memtest' command. Which would in turn call mem_test() which would eventually call show_progress(). That last function, if build without -mno-unaligned-access would result in unaligned memory access which would result in Barebox hanging. This patch instructs the compiler to not generate any unaligned accesses to memory thus avoiding the problem. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/Makefile')
-rw-r--r--arch/arm/Makefile7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 721aa9bd9d..cae05ff52b 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -13,6 +13,13 @@ AS += -EL
LD += -EL
endif
+# Unaligned access is not supported when MMU is disabled, so given how
+# at least some of the code would be executed with MMU off, lets be
+# conservative and instruct the compiler not to generate any unaligned
+# accesses
+CFLAGS += -mno-unaligned-access
+
+
# This selects which instruction set is used.
# Note that GCC does not numerically define an architecture version
# macro, but instead defines a whole series of macros which makes