From 531a39d21e62e543e474ef0981b1c37b81c8e9be Mon Sep 17 00:00:00 2001 From: Bernd Kuhls Date: Mon, 24 Nov 2025 20:00:14 +0100 Subject: [PATCH] boot/syslinux: add -std=gnu17 only for gcc >= 8 Buildroot commit f5101638b9f917dc4c569828ff3fee0c486ba8f8 unconditionally added -std=gnu17 breaking the build with older gcc versions: https://lore.kernel.org/buildroot/20250815121815.436050ec@windsurf/ Reported-by: Thomas Petazzoni Signed-off-by: Bernd Kuhls [Julien: update message url to use lore] Signed-off-by: Julien Olivain --- boot/syslinux/syslinux.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/boot/syslinux/syslinux.mk b/boot/syslinux/syslinux.mk index b8f022b189..f938634c35 100644 --- a/boot/syslinux/syslinux.mk +++ b/boot/syslinux/syslinux.mk @@ -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)" \