Skip to content

Commit

Permalink
ARM: Prevent the compiler from using NEON registers
Browse files Browse the repository at this point in the history
For ARMv8-A, NEON is standard, so the compiler can use it even when no
special target flags are provided. For example, it can use stores from
NEON registers to zero-initialize large structures. GCC 11 decides to
do this inside the DRAM init code for the Allwinner H6.

However, GCC 11 has a bug where it generates misaligned NEON register
stores even with -mstrict-align. Since the MMU is not enabled this early
in SPL, the misaligned store causes an exception and breaks booting.

Work around this issue by restricting the compiler to using GPRs only,
not vector registers. This prevents any future surprises relating to
NEON use as well.

Signed-off-by: Samuel Holland <[email protected]>
Acked-by: Andre Przywara <[email protected]>
  • Loading branch information
smaeul authored and trini committed Sep 2, 2021
1 parent e0bd6f3 commit f43312c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ endif

PLATFORM_RELFLAGS += -fno-common -ffixed-r9
PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \
$(call cc-option,-mgeneral-regs-only) \
$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))

# LLVM support
Expand Down

0 comments on commit f43312c

Please sign in to comment.