[PATCH] arm: enable unaligned accesses by default if EFI is configured

Tom Rini trini at konsulko.com
Fri Mar 17 15:35:04 CET 2023


On Fri, Mar 17, 2023 at 04:01:58PM +0200, Ilias Apalodimas wrote:
> Hi Heinrich,
> 
> On Fri, Mar 17, 2023 at 02:56:02PM +0100, Heinrich Schuchardt wrote:
> > On 3/17/23 14:42, Ilias Apalodimas wrote:
> > > Heinrich reports that compiling with LTO & EFI breaks armv7 and arm11*
> > > builds.  The reason is that LTO (maybe a binutils bug?) replaces the
> > > asm version of allow_unaligned() with the __weak definition of the
> > > function.  As a result EFI code ends up running with unaligned accesses
> > > disabled and eventually crashes.
> > >
> > > So let's enable unaligned access for those architectures during
> > > our start.S routines and avoid the linker issues.
> > >
> > > Reported-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> >
> > The problem was originally reported by Tom. My contribution was to track it
> > down to missing enabling of unaligned access due to a linker problem.
> >
> 
> Ah thanks, I'll fix that in v2
> 
> [...]
> 
> > >   	bic	r0, r0, #0x00002300	@ clear bits 13, 9:8 (--V- --RS)
> > >   	bic	r0, r0, #0x00000087	@ clear bits 7, 2:0 (B--- -CAM)
> > > +#if !CONFIG_IS_ENABLED(EFI_LOADER)
> > > +	/* allow unaligned accesses since EFI requires it */
> >
> > This comment line is only reached without UEFI support. So here you should
> > explain why we forbid unaligned access without UEFI.
> 
> I am not sure I am following.  I don't really remember why we had UA
> disabled on armv7.  Do you have any suggestions?

Poke around git blame here, there should be enough links to bring  up
what / why we do what we do :)

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230317/85b43214/attachment.sig>


More information about the U-Boot mailing list