[Buildroot] [Bug 13586] New: grub failure with BR2_OPTIMIZE_3
Andreas Hilse
andreas.hilse at googlemail.com
Fri May 28 13:48:38 UTC 2021
Hello Yann, David,
> Would you please send a patch with such a workaround, please?
I tried to workaround in grub2.mk setting -Os as additional flags in
the TARGET_* variables for GRUB2_CONF_ENV as that seemed the right
place according to this comment:
# Grub2 is kind of special: it considers CC, LD and so on to be the
# tools to build the host programs and uses TARGET_CC, TARGET_CFLAGS,
# TARGET_CPPFLAGS, TARGET_LDFLAGS to build the bootloader itself.
...
GRUB2_CONF_ENV = \
CPP="$(TARGET_CC) -E" \
TARGET_CC="$(TARGET_CC)" \
TARGET_CFLAGS="$(TARGET_CFLAGS) -Os" \
TARGET_CPPFLAGS="$(TARGET_CPPFLAGS) -Os -fno-stack-protector" \
TARGET_LDFLAGS="$(TARGET_LDFLAGS) -Os" \
TARGET_NM="$(TARGET_NM)" \
TARGET_OBJCOPY="$(TARGET_OBJCOPY)" \
TARGET_STRIP="$(TARGET_CROSS)strip"
But -O2 still is in the build commands in a place after -Os and thus
takes preference.
Do you have any suggestions for a different workaround or on how to
fix the above one?
Andreas
More information about the buildroot
mailing list