From: Christian Storm <christian.st...@siemens.com> Use objcopy with target=efi-app for * x86 across the board(s) * aarch64 with gnu-efi > 3.0.15
Use objcopy with binary copy mode for * arm * riscv64 * aarch64 with gnu-efi = 3.0.15 This list is compiled from gnu-efi's gnuefi/crt0-efi-<ARCH>.S assembler files over the releases 3.0.15 to 3.0.18. If the respective file contains the PE/COFF header definition, objcopy with binary copy mode has to be used. Else, objcopy with target=efi-app has to be used. Signed-off-by: Christian Storm <christian.st...@siemens.com> Tested-by: Quirin Gylstorff <quirin.gylsto...@siemens.com> --- Makefile.am | 6 +++--- configure.ac | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9bff305..0bd2dec 100644 --- a/Makefile.am +++ b/Makefile.am @@ -246,11 +246,11 @@ efi_ldflags = \ if ARCH_IS_X86 objcopy_format = --target=efi-app-$(ARCH) else -if OBJCOPY_USE_EFI_APP_TARGET -objcopy_format = --target=efi-app-$(ARCH) -else +if OBJCOPY_USE_BINARY_COPY objcopy_format = -O binary efi_ldflags += --defsym=EFI_SUBSYSTEM=0xa +else +objcopy_format = --target=efi-app-$(ARCH) endif endif diff --git a/configure.ac b/configure.ac index 7112b3c..e58065f 100644 --- a/configure.ac +++ b/configure.ac @@ -237,11 +237,15 @@ fi AC_SUBST([GNU_EFI_VERSION], [$(($PKG_CONFIG --modversion "gnu-efi" 2>/dev/null || echo 0) | $TR -d '.' )]) AC_SUBST([OBJCOPY_HAS_EFI_APP_TARGET], [$($OBJCOPY --info | $GREP -q pei- 2>/dev/null && echo "true")]) -if test -z $OBJCOPY_HAS_EFI_APP_TARGET && test $GNU_EFI_VERSION -gt 0; then - AC_MSG_ERROR([objcopy doesn't support --target=efi-app but gnu-efi >= 3.0.16]) + +# Use objcopy -O binary on riscv64, arm, and aarch64 with gnu-efi 3.0.15 +AM_CONDITIONAL([OBJCOPY_USE_BINARY_COPY], + [test "$ARCH" = "arm" || test "$ARCH" = "riscv64" || test "$ARCH" = "aarch64" -a $GNU_EFI_VERSION -eq 0]) + +# Ensure objcopy supports target=efi-app for x86 across the board(s) and aarch64 with gnu-efi > 3.0.15 +if test -z "$ARCH_IS_X86_TRUE" -a -z "$OBJCOPY_HAS_EFI_APP_TARGET" || test "$ARCH" = "aarch64" -a -z "$OBJCOPY_HAS_EFI_APP_TARGET" -a $GNU_EFI_VERSION -gt 0; then + AC_MSG_ERROR([objcopy doesn't support --target=efi-app but that is needed by gnu-efi]) fi -AM_CONDITIONAL([OBJCOPY_USE_EFI_APP_TARGET], - [test -n $OBJCOPY_HAS_EFI_APP_TARGET && test $GNU_EFI_VERSION -gt 0]) # Use --no-warn-rwx-segments for gnu-efi version 3.0.15 # on non-x86 architectures. -- 2.45.0 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to efibootguard-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/22D6370F-438E-4691-8A04-C1F1C1332921%40siemens.com.