From decee20ec84977ae1d1a7f54fa91e73017f6731d Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 26 Jun 2020 21:21:31 +0100 Subject: [PATCH] [build] Disable position-independent code for ARM64 EFI builds Some versions of gcc (observed with the cross-compiling gcc 9.3.0 in Ubuntu 20.04) default to enabling -fPIE. Experimentation shows that this results in the emission of R_AARCH64_ADR_GOT_PAGE relocation records for __stack_chk_guard. These relocation types are not supported by elf2efi.c. Fix by explicitly disabling position-independent code for ARM64 EFI builds. Debugged-by: Antony Messerli Signed-off-by: Michael Brown --- src/arch/arm64/Makefile.efi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/arch/arm64/Makefile.efi b/src/arch/arm64/Makefile.efi index 998a64d03..eb04c0e2f 100644 --- a/src/arch/arm64/Makefile.efi +++ b/src/arch/arm64/Makefile.efi @@ -1,5 +1,9 @@ # -*- makefile -*- : Force emacs to use Makefile mode +# Avoid untranslatable relocations +# +CFLAGS += -fno-pic + # Specify EFI image builder # ELF2EFI = $(ELF2EFI64)