[PATCH] Makefile: use --output-target instead of --target

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Mon Dec 8 21:47:38 CET 2025


The objcopy man-page teaches:

    --target=bfdname
      Use bfdname as the object format for
      both the input and the output file

This implies for --target=efi-app-x86_64 that the input file would have
to be an EFI app.

Objcopy in binutils 2.45 checks this more strictly than previous versions
and refuses to accept an ELF file as input with --target=efi-app-x86_64.

Replace --target by --output-target for building sandbox and x86 EFI
binaries.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 arch/sandbox/config.mk | 4 ++--
 arch/x86/config.mk     | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index 9a61e803a57..275661a1f3a 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -50,10 +50,10 @@ cmd_u-boot-spl = (cd $(obj) && \
 
 ifeq ($(HOST_ARCH),$(HOST_ARCH_X86_64))
 EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_x86_64_efi.lds
-EFI_TARGET := --target=efi-app-x86_64
+EFI_TARGET := --output-target=efi-app-x86_64
 else ifeq ($(HOST_ARCH),$(HOST_ARCH_X86))
 EFI_LDS := ${SRCDIR}/../../../arch/x86/lib/elf_ia32_efi.lds
-EFI_TARGET := --target=efi-app-ia32
+EFI_TARGET := --output-target=efi-app-ia32
 else ifeq ($(HOST_ARCH),$(HOST_ARCH_AARCH64))
 EFI_LDS := ${SRCDIR}/../../../arch/arm/lib/elf_aarch64_efi.lds
 OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \
diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 6d4839dfb38..c2bb5549b7c 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -69,7 +69,7 @@ endif
 
 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)
+OBJCOPYFLAGS_EFI += --output-target=efi-app-$(EFIARCH)
 
 CPPFLAGS_REMOVE_crt0-efi-$(EFIARCH).o += $(CFLAGS_NON_EFI)
 CPPFLAGS_crt0-efi-$(EFIARCH).o += $(CFLAGS_EFI)
@@ -127,7 +127,7 @@ endif
 endif
 
 ifdef CONFIG_X86_64
-EFI_TARGET := --target=efi-app-x86_64
+EFI_TARGET := --output-target=efi-app-x86_64
 else
-EFI_TARGET := --target=efi-app-ia32
+EFI_TARGET := --output-target=efi-app-ia32
 endif
-- 
2.51.0



More information about the U-Boot mailing list