diff mbox series

[v5,27/28] x86: efi: Set the correct link flags for the 64-bit EFI app

Message ID 20211204085647.v5.27.Id52316b4a3898ba8dff4c085a2c320173e7b35ea@changeid
State Changes Requested, archived
Delegated to: Heinrich Schuchardt
Headers show
Series efi: Improvements to U-Boot running on top of UEFI | expand

Commit Message

Simon Glass Dec. 4, 2021, 3:56 p.m. UTC
At present some 32-bit settings are used with the 64-bit app. Fix this by
separating out the two cases.

Be careful not to break the 64-bit payload, which needs to build a 64-bit
EFI stub with a 32-bit U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v5:
- Add new patch to set the correct link flags for the 64-bit EFI app

 arch/x86/config.mk | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Comments

Christian Melki Dec. 5, 2021, 2:03 p.m. UTC | #1
On 12/4/21 16:56, Simon Glass wrote:
> At present some 32-bit settings are used with the 64-bit app. Fix this by
> separating out the two cases.
> 
> Be careful not to break the 64-bit payload, which needs to build a 64-bit
> EFI stub with a 32-bit U-Boot.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Christian Melki <christian.melki@t2data.com>
> ---
> 
> Changes in v5:
> - Add new patch to set the correct link flags for the 64-bit EFI app
> 
>  arch/x86/config.mk | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/config.mk b/arch/x86/config.mk
> index 589f2aed2bc..889497b6bd7 100644
> --- a/arch/x86/config.mk
> +++ b/arch/x86/config.mk
> @@ -20,6 +20,11 @@ IS_32BIT := y
>  endif
>  endif
>  
> +EFI_IS_32BIT := $(IS_32BIT)
> +ifdef CONFIG_EFI_STUB_64BIT
> +EFI_IS_32BIT :=
> +endif
> +
>  ifeq ($(IS_32BIT),y)
>  PLATFORM_CPPFLAGS += -march=i386 -m32
>  else
> @@ -44,8 +49,14 @@ CFLAGS_EFI := -fpic -fshort-wchar
>  # Compiler flags to be removed when building UEFI applications
>  CFLAGS_NON_EFI := -mregparm=3 -fstack-protector-strong
>  
> -ifeq ($(CONFIG_EFI_STUB_64BIT),)
> +ifeq ($(IS_32BIT),y)
> +EFIPAYLOAD_BFDARCH = i386
> +else
>  CFLAGS_EFI += $(call cc-option, -mno-red-zone)
> +EFIPAYLOAD_BFDARCH = x86_64
> +endif
> +
> +ifeq ($(EFI_IS_32BIT),y)
>  EFIARCH = ia32
>  EFIPAYLOAD_BFDTARGET = elf32-i386
>  else
> @@ -53,8 +64,6 @@ EFIARCH = x86_64
>  EFIPAYLOAD_BFDTARGET = elf64-x86-64
>  endif
>  
> -EFIPAYLOAD_BFDARCH = i386
> -
>  LDSCRIPT_EFI := $(srctree)/arch/x86/lib/elf_$(EFIARCH)_efi.lds
>  EFISTUB := crt0_$(EFIARCH)_efi.o reloc_$(EFIARCH)_efi.o
>  OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH)
>
diff mbox series

Patch

diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 589f2aed2bc..889497b6bd7 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -20,6 +20,11 @@  IS_32BIT := y
 endif
 endif
 
+EFI_IS_32BIT := $(IS_32BIT)
+ifdef CONFIG_EFI_STUB_64BIT
+EFI_IS_32BIT :=
+endif
+
 ifeq ($(IS_32BIT),y)
 PLATFORM_CPPFLAGS += -march=i386 -m32
 else
@@ -44,8 +49,14 @@  CFLAGS_EFI := -fpic -fshort-wchar
 # Compiler flags to be removed when building UEFI applications
 CFLAGS_NON_EFI := -mregparm=3 -fstack-protector-strong
 
-ifeq ($(CONFIG_EFI_STUB_64BIT),)
+ifeq ($(IS_32BIT),y)
+EFIPAYLOAD_BFDARCH = i386
+else
 CFLAGS_EFI += $(call cc-option, -mno-red-zone)
+EFIPAYLOAD_BFDARCH = x86_64
+endif
+
+ifeq ($(EFI_IS_32BIT),y)
 EFIARCH = ia32
 EFIPAYLOAD_BFDTARGET = elf32-i386
 else
@@ -53,8 +64,6 @@  EFIARCH = x86_64
 EFIPAYLOAD_BFDTARGET = elf64-x86-64
 endif
 
-EFIPAYLOAD_BFDARCH = i386
-
 LDSCRIPT_EFI := $(srctree)/arch/x86/lib/elf_$(EFIARCH)_efi.lds
 EFISTUB := crt0_$(EFIARCH)_efi.o reloc_$(EFIARCH)_efi.o
 OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH)