[PATCH 4/7] Makefile.lib: Enforce EFI CFLAGS/AFLAGS

Jiaxun Yang jiaxun.yang at flygoat.com
Fri May 17 18:32:55 CEST 2024


EFI AFLAGS/CFLAGS should be enforced for those runtime
supporting files as well, otherwise EFI applications
will fail to compile on MIPS.

Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
---
 Makefile             | 3 +++
 scripts/Makefile.lib | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 44deb339af19..6c9098f5823f 100644
--- a/Makefile
+++ b/Makefile
@@ -652,6 +652,8 @@ export EFI_CRT0		# Filename of EFI CRT0 in arch/$(ARCH)/lib
 export EFI_RELOC	# Filename of EFU relocation code in arch/$(ARCH)/lib
 export CFLAGS_EFI	# Compiler flags to add when building EFI app
 export CFLAGS_NON_EFI	# Compiler flags to remove when building EFI app
+export AFLAGS_EFI	# Assembler flags to add when building EFI app
+export AFLAGS_NON_EFI	# Assembler flags to remove when building EFI app
 export EFI_TARGET	# binutils target if EFI is natively supported
 
 export LTO_ENABLE
@@ -926,6 +928,7 @@ export PLATFORM_LIBGCC
 LDPPFLAGS += \
 	-include $(srctree)/include/u-boot/u-boot.lds.h \
 	-DCPUDIR=$(CPUDIR) \
+	-DARCHDIR=arch/$(ARCH) \
 	$(shell $(LD) --version | \
 	  sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
 
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 52aed7a65d47..5aacab32cb38 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -495,8 +495,12 @@ $(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_free
 
 targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
 
-CFLAGS_REMOVE_efi_reloc.o := $(LTO_CFLAGS)
-CFLAGS_REMOVE_efi_freestanding.o := $(LTO_CFLAGS)
+AFLAGS_efi_crt0.o := $(AFLAGS_EFI)
+CFLAGS_efi_reloc.o := $(CFLAGS_EFI)
+CFLAGS_efi_freestanding.o := $(CFLAGS_EFI)
+AFLAGS_REMOVE_efi_crt0.o := $(AFLAGS_NON_EFI)
+CFLAGS_REMOVE_efi_reloc.o := $(CFLAGS_NON_EFI) $(LTO_CFLAGS)
+CFLAGS_REMOVE_efi_freestanding.o := $(CFLAGS_NON_EFI) $(LTO_CFLAGS)
 
 # ACPI
 # ---------------------------------------------------------------------------

-- 
2.34.1



More information about the U-Boot mailing list