diff mbox series

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

Message ID 20240517-mips-efi-v1-4-79096e3ca3b3@flygoat.com
State New
Delegated to: Heinrich Schuchardt
Headers show
Series MIPS: Enable EFI support | expand

Commit Message

Jiaxun Yang May 17, 2024, 4:32 p.m. UTC
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@flygoat.com>
---
 Makefile             | 3 +++
 scripts/Makefile.lib | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Heinrich Schuchardt May 17, 2024, 6:48 p.m. UTC | #1
Am 17. Mai 2024 18:32:55 MESZ schrieb Jiaxun Yang <jiaxun.yang@flygoat.com>:
>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@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) \

This change seems to be unrelated.

> 	$(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
> # ---------------------------------------------------------------------------
>
diff mbox series

Patch

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
 # ---------------------------------------------------------------------------