[U-Boot] ARMv7 and unaligned access issues
Tom Rini
trini at ti.com
Tue Sep 25 20:54:56 CEST 2012
Hi Albert (and everyone else),
For background, we've discussed the problem of ARM and unaligned access
before at:
http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/132780
Now, to try and summarize things:
(1): All ARMv7 hardware must support unaligned access, if set.
(2): All gcc 4.7 (and gcc 4.6 from Linaro) default to saying this access
will be enabled / supported.
(3): In some cases these gcc versions will store string constants
unaligned. For example, char mac[16] = "ethaddr" in
common/fdt_support.c::fdt_fixup_ethernet (at least one more example
exists today, fs/ubifs/super.c::ubifs_mount). This is a valid C
construct.
Now, how do we want to handle this? We can do:
(a): Tell gcc to use -mno-unaligned-access
(b): Set the correct bit to allow unaligned access on ARMv7
(c): Case-by-case fixup of code.
Option 'a' is what we did for v2012.07 with an immediate revert and plan
to "fix" things for the next release. Option 'b' is what started the
above mentioned thread. Option 'c' seems to be the path forward based
on reverting 'a'.
However, this seems very problematic as we're disallowing valid C code
and we have to be sure that we don't introduce further breakage later.
In my read of the original thread it doesn't seem like this was the
intended consequence of saying we'll fix up the code. I would suggest
we follow the kernel's lead here and go back and do option b.
--
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/20120925/a6a8736f/attachment.pgp>
More information about the U-Boot
mailing list