[PATCH 1/2] ARM: added Kconfig option for -mno-unaligned compiler flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With recent gcc, unaligned access is enabled by default on ARMv6+
CPUs.  This can cause problems when bootloader is located e.g. in SRAM
where such an access is not supported.

Patch adds a Kconfig option were the default behavior can be overridden.

Signed-off-by: Enrico Scholz <enrico.scholz@xxxxxxxxxxxxxxxxx>
---
 arch/arm/Kconfig  | 8 ++++++++
 arch/arm/Makefile | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3afd885..53c36d1 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -200,6 +200,14 @@ config ARM_UNWIND
 	  the performance is not affected. Currently, this feature
 	  only works with EABI compilers. If unsure say Y.
 
+config ARM_NOUNALIGNED
+	bool "disable unaligned access"
+        help
+          With recent gcc, unaligned access is enabled by default on ARMv6+
+          CPUs.  This can cause problems when bootloader is located e.g. in
+          SRAM were such an access is not supported. Selection this option
+          sets the '-mno-unaligned-access' compiler flag.
+
 endmenu
 
 source common/Kconfig
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 8cef771..9544cca 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -39,6 +39,10 @@ ifeq ($(CONFIG_ARM_UNWIND),y)
 CFLAGS_ABI	+=-funwind-tables
 endif
 
+ifeq ($(CONFIG_ARM_NOUNALIGNED),y)
+CFLAGS_ABI	+=$(call cc-option,-mno-unaligned-access)
+endif
+
 ifeq ($(CONFIG_THUMB2_BAREBOX),y)
 AFLAGS_AUTOIT	:=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
 AFLAGS_NOWARN	:=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
-- 
1.7.11.7


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux