From 1a52a4fe51a61297cfe18aa7307d330076d3a6aa Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Tue, 10 May 2022 16:49:39 +0200 Subject: [PATCH] payloads/grub: Work around entry point issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With -Os grub-mkimage does not create an elf with the correct entry point because some parts of the elf images are placed in .text.unlikely. The linker does not know where to place that and places it below .text, hence messing up the entry point. To avoid this use the compiler flag -fno-reorder-functions. Change-Id: Ic4a12f45d30b781870faa38575e8b2c10e0a42e8 Resolves: https://ticket.coreboot.org/issues/343 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/64235 Reviewed-by: Nico Huber Reviewed-by: Hackware Reviewed-by: Sean Rhodes Reviewed-by: Michael Niewöhner Reviewed-by: Paul Menzel Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- payloads/external/GRUB2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/payloads/external/GRUB2/Makefile b/payloads/external/GRUB2/Makefile index 31b0f53b18..5e82f3e13f 100644 --- a/payloads/external/GRUB2/Makefile +++ b/payloads/external/GRUB2/Makefile @@ -34,7 +34,7 @@ grub2/build/config.h: $(CONFIG_DEP) | checkout cd grub2/build && ../configure CC="$(HOSTCC)" LD="$(LD)" \ FREETYPE="pkg-config freetype2" BUILD_FREETYPE="pkg-config freetype2" \ TARGET_CC="$(CC)" TARGET_OBJCOPY="$(OBJCOPY)" TARGET_STRIP="$(STRIP)" \ - CFLAGS=-O2 TARGET_CFLAGS=-Os \ + CFLAGS=-O2 TARGET_CFLAGS="-Os -fno-reorder-functions" \ --with-platform=coreboot --enable-boot-time --disable-werror config: grub2/build/config.h checkout