boot/syslinux: add -std=gnu17 only for gcc >= 8

Buildroot commit f5101638b9 unconditionally
added -std=gnu17 breaking the build with older gcc versions:
https://lore.kernel.org/buildroot/20250815121815.436050ec@windsurf/

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[Julien: update message url to use lore]
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Bernd Kuhls
2025-11-24 20:00:14 +01:00
committed by Julien Olivain
parent 35d8a3a0ca
commit 531a39d21e

View File

@@ -56,6 +56,9 @@ SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP
# syslinux build system has no convenient way to pass CFLAGS,
# and the internal zlib should take precedence so -I shouldn't
# be used.
# gcc-15 defaults to -std=gnu23 which introduces build failures.
# We force "-std=gnu17" for gcc version supporting it. Earlier gcc
# versions will work, since they are using the older standard.
# Install in a temporary location that eases final install into
# images/ (see corresponding command, below).
# Repeat the target, otherwise syslinux will try to build everything
@@ -65,7 +68,7 @@ define SYSLINUX_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE1) \
ASCIIDOC_OK=-1 \
A2X_XML_OK=-1 \
CC="$(TARGET_CC) -std=gnu17" \
CC="$(TARGET_CC) $(if $(BR2_TOOLCHAIN_GCC_AT_LEAST_8),-std=gnu17)" \
LD="$(TARGET_LD)" \
OBJCOPY="$(TARGET_OBJCOPY)" \
AS="$(TARGET_AS)" \