[U-Boot] [PATCH V3] ARM: prevent misaligned array inits

Tom Rini trini at ti.com
Mon Oct 8 21:31:25 CEST 2012


On Mon, Oct 08, 2012 at 09:19:04PM +0200, Albert ARIBAUD wrote:

> 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 <albert.u.boot at aribaud.net>
[snip]
> diff --git a/common/Makefile b/common/Makefile
> index 973f05a..39dbe16 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -232,6 +232,9 @@ $(obj)env_embedded.o: $(src)env_embedded.c $(obj)../tools/envcrc
>  $(obj)../tools/envcrc:
>  	$(MAKE) -C ../tools
>  
> +$(obj)hush.o: CFLAGS += -mno-unaligned-access
> +$(obj)fdt_support.o: CFLAGS += -mno-unaligned-access

Forgot a '# SEE doc/...' here.

[snip]
> +If you are reading this because of a data abort: the following MIGHT
> +be relevant to your abort, if it was caused by an alignment violation.
> +In order to determine this, use the PC from the abort dump along with
> +an objdump -s -S of the u-boot ELF binary to locate the function where
> +the abort happened; then compare this function with the examples below.

You should also add something about how if you are able to reach the
U-Boot prompt before the abort happens, if CONFIG_CMD_BDI is set the
'bdinfo' command will give you the relocation offset to apply to the PC.

Otherwise looks good.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121008/babc6a27/attachment.pgp>


More information about the U-Boot mailing list