[ipxe-devel] [PATCH 1/1] [arm] add -mno-unaligned-access compiler flag

Mark Rutland mark.rutland at arm.com
Thu Mar 29 09:20:45 UTC 2018


Hi,

On Wed, Mar 28, 2018 at 10:19:50PM +0200, Heinrich Schuchardt wrote:
> Without the flag a "data abort" occured when compiling with gcc 6.3 for
> armhf and running on an Allwinner A20 SOC in function efi_devpath_end().

I think this may be a bug in the UEFI implementation (which I guess is
U-Boot?). In the 2.7 UEFI spec, section 2.3.5 states that for AArch32:

  Unaligned access should be enabled if supported; Alignment faults are
  enabled otherwise.

All ARMv6 and ARMv7 CPUs (including the COrtex-A7s in the A20 SoC)
support unaligned accesses to normal memory, as would be the case for
memory accessed by efi_devpath_end().

Unless GCC is generating misaligned LDM/STM instructions, I believe this
is a FW bug that would be worth reporting, regardless of whether this
patch is taken on the IPXE side.

Thanks,
Mark.

> 
> The flag is usable both with GCC and LLVM.
> 
> With some console commands enabled bin-arm32-efi/snp.efi grows from 148448
> to 154464 bytes.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  src/arch/arm32/Makefile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/arch/arm32/Makefile b/src/arch/arm32/Makefile
> index 3a7c0923..fc72af11 100644
> --- a/src/arch/arm32/Makefile
> +++ b/src/arch/arm32/Makefile
> @@ -5,6 +5,7 @@ SRCDIRS		+= arch/arm32/libgcc
>  
>  # ARM32-specific flags
>  #
> +CFLAGS		+= -mno-unaligned-access
>  CFLAGS		+= -mthumb -mcpu=cortex-a15 -mabi=aapcs -mfloat-abi=soft
>  CFLAGS		+= -mword-relocations
>  ASFLAGS		+= -mthumb -mcpu=cortex-a15
> -- 
> 2.11.0
> 
> _______________________________________________
> ipxe-devel mailing list
> ipxe-devel at lists.ipxe.org
> https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel



More information about the ipxe-devel mailing list