From b823fd9ba56d56e3cbb5b05e7a4815fb0914204a Mon Sep 17 00:00:00 2001 From: Albert ARIBAUD Date: Tue, 9 Oct 2012 09:28:15 +0000 Subject: ARM: prevent misaligned array inits Under option -munaligned-access, gcc can perform local char or 16-bit array initializations using misaligned native accesses which will throw a data abort exception. Fix files where these array initializations were unneeded, and for files known to contain such initializations, enforce gcc option -mno-unaligned-access. Signed-off-by: Albert ARIBAUD [trini: Switch to usign call cc-option for -mno-unaligned-access as Albert had done previously as that's really correct] Signed-off-by: Tom Rini --- common/Makefile | 4 ++++ common/cmd_dfu.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/Makefile b/common/Makefile index 973f05a..33c606a 100644 --- a/common/Makefile +++ b/common/Makefile @@ -232,6 +232,10 @@ $(obj)env_embedded.o: $(src)env_embedded.c $(obj)../tools/envcrc $(obj)../tools/envcrc: $(MAKE) -C ../tools +# SEE README.arm-unaligned-accesses +$(obj)hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED) +$(obj)fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED) + ######################################################################### # defines $(obj).depend target diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c index 62fb890..01d6b3a 100644 --- a/common/cmd_dfu.c +++ b/common/cmd_dfu.c @@ -30,7 +30,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { const char *str_env; - char s[] = "dfu"; + char *s = "dfu"; char *env_bkp; int ret; -- cgit v1.1