payloads/grub: Work around entry point issue

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 <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64235
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Hackware <human@hackware.cl>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Arthur Heymans 2022-05-10 16:49:39 +02:00
parent 512b1a7724
commit 1a52a4fe51
1 changed files with 1 additions and 1 deletions

View File

@ -34,7 +34,7 @@ grub2/build/config.h: $(CONFIG_DEP) | checkout
cd grub2/build && ../configure CC="$(HOSTCC)" LD="$(LD)" \ cd grub2/build && ../configure CC="$(HOSTCC)" LD="$(LD)" \
FREETYPE="pkg-config freetype2" BUILD_FREETYPE="pkg-config freetype2" \ FREETYPE="pkg-config freetype2" BUILD_FREETYPE="pkg-config freetype2" \
TARGET_CC="$(CC)" TARGET_OBJCOPY="$(OBJCOPY)" TARGET_STRIP="$(STRIP)" \ 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 --with-platform=coreboot --enable-boot-time --disable-werror
config: grub2/build/config.h checkout config: grub2/build/config.h checkout