[U-Boot] [PATCH] fdt: remove unaligned access in fdt_fixup_ethernet()

Stephen Warren swarren at wwwdotorg.org
Tue May 28 06:16:29 CEST 2013


On 05/27/2013 10:05 PM, Michael Trimarchi wrote:
> Hi
> 
> On May 28, 2013 6:02 AM, "Stephen Warren" <swarren at wwwdotorg.org
> <mailto:swarren at wwwdotorg.org>> wrote:
>>
>> Some ARM compilers may emit code that makes unaligned accesses when
>> faced with constructs such as:
>>
>> char mac[16] = "ethaddr";
>>
> 
> Recently I have seen some of this emails. I understand the problem but
> is it a compiler problem? Is it reported somewhere?

The situation is explained in doc/README.arm-unaligned-accesses.

IIUC, the basic synopsis is that before ARMv7, the HW could not perform
unaligned accesses, whereas ARMv7 and later can (with an enable bit in
HW). Newer gcc takes advantage of this fact when it knows it's compiling
for ARMv7 or later. However, in order to support pre-ARMv7, U-Boot has
disabled this feature even on ARMv7 HW at runtime, so it's obvious where
the code is making unaligned accesses, so U-Boot still works on
pre-ARMv7. However, where gcc "implicitly" emits unaligned accesses, we
have to fix them up, as in this patch.


More information about the U-Boot mailing list