From a4595070fc88858bea0bca8755944ecfeb1dd0a1 Mon Sep 17 00:00:00 2001 From: Dongyan Qian Date: Fri, 8 May 2026 11:55:47 +0800 Subject: [PATCH] Make.defaults: disable LSX/LASX for loongarch64 EFI code UEFI applications should not rely on LoongArch SIMD state being available or preserved by firmware. When gnu-efi is built with toolchain defaults that enable LSX or LASX, libefi.a can contain SIMD instructions. One observed case is RtCompareGuid from libefi.a:efirtlib.o being compiled with LSX instructions such as vld, vsub.w, vbsrl.v, vor.v and vpickve2gr.w. EFI applications linking against libefi.a then inherit those instructions even if they disable SIMD in their own build flags. Add -mno-lsx and -mno-lasx for loongarch64 builds to keep the gnu-efi runtime libraries compatible with baseline LoongArch64 firmware environments. Reported-by: Zixuan Lu Co-authored-by: Xiaotian Wu Signed-off-by: Dongyan Qian --- Make.defaults | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Make.defaults b/Make.defaults index cf7a88e..b8a32b6 100755 --- a/Make.defaults +++ b/Make.defaults @@ -204,6 +204,10 @@ ifeq ($(ARCH),mips64el) ARCH3264 = -mabi=64 endif +ifeq ($(ARCH),loongarch64) +EFI_CFLAGS += -mno-lsx -mno-lasx +endif + # # Set HAVE_EFI_OBJCOPY if objcopy understands --target efi-[app|bsdrv|rtdrv], # otherwise we need to compose the PE/COFF header using the assembler