Skip to contentSkip to conversation

toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_109809

PATCH In review Giulio Benetti 2 participants 3 messages Feb 5, 2024 – Aug 6, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_109809

htop package fails to build for the RISCV64 architecture with optimization enabled with gcc = 13.2.0 and it's still present in gcc = 14.x as reported upstream:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109809

So let's introduce BR2_TOOLCHAIN_HAS_GCC_BUG_109809 to handle packages affected by it like htop.

---
 toolchain/Config.in | 8 ++++++++
 1 file changed, 8 insertions(+)
toolchain/Config.in +8 -0
index 34e0ae2c5f..64084dffe3 100644
@@ -250,6 +250,14 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_107728
 	depends on BR2_TOOLCHAIN_USES_GLIBC
 	depends on BR2_OPTIMIZE_0
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109809
+# ICE: in dwarf2out_frame_debug_cfa_offset
+# Shows up starting from Gcc 13.2.0 and still has to be fixed
+config BR2_TOOLCHAIN_HAS_GCC_BUG_109809
+	bool
+	default y if BR2_RISCV_64
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_13
+
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110934
 # ICE: on M68K: in change_address_1, at emit-rtl.cc:2287
 # This bug exists in gcc = 12.3.0 and gcc = 13.2.0
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/htop: fix build failure due to gcc bug 109809

The htop package exhibits gcc bug 109809 when built for the RISCV64 architecture with optimization enabled, which causes a build failure.

As done for other packages in Buildroot work around this gcc bug by setting optimization to -O0 if BR2_TOOLCHAIN_HAS_GCC_BUG_109809=y.

Fixes:
still not happened. It shows up while building under docker-run this pending patch-set:
https://patchwork.ozlabs.org/project/buildroot/list/?series=384841

---
 package/htop/htop.mk | 8 ++++++++
 1 file changed, 8 insertions(+)
package/htop/htop.mk +8 -0
index 6dbaae3796..853620dfe8 100644
@@ -13,10 +13,18 @@ HTOP_CONF_ENV = HTOP_NCURSES_CONFIG_SCRIPT=$(STAGING_DIR)/usr/bin/$(NCURSES_CONF
 HTOP_LICENSE = GPL-2.0+
 HTOP_LICENSE_FILES = COPYING
 
+HTOP_CFLAGS = $(TARGET_CFLAGS)
+
 # ac_cv_prog_cc_c99 is required for BR2_USE_WCHAR=n because the C99 test
 # provided by autoconf relies on wchar_t.
 HTOP_CONF_ENV += ac_cv_prog_cc_c99=-std=gnu99
 
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_109809),y)
+HTOP_CFLAGS += -O0
+endif
+
+HTOP_CONF_ENV += CFLAGS="$(HTOP_CFLAGS)"
+
 ifeq ($(BR2_PACKAGE_HWLOC),y)
 HTOP_CONF_OPTS += --enable-hwloc
 HTOP_DEPENDENCIES += hwloc
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/2] package/htop: fix build failure due to gcc bug 109809

Hello Giulio,

Quoted 10 lines · On Mon, 5 Feb 2024 18:23:27 +0100 Giulio Benetti…

The htop package exhibits gcc bug 109809 when built for the RISCV64 architecture with optimization enabled, which causes a build failure.

As done for other packages in Buildroot work around this gcc bug by setting optimization to -O0 if BR2_TOOLCHAIN_HAS_GCC_BUG_109809=y.

Fixes:
still not happened. It shows up while building under docker-run this pending patch-set:
https://patchwork.ozlabs.org/project/buildroot/list/?series=384841

Unfortunately, this is not very useful, because this patch series is no longer there. I just did a build like this:

BR2_riscv=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_HTOP=y
# BR2_TARGET_ROOTFS_TAR is not set

it uses gcc 13.x, on RISC-V 64-bit and it builds fine.

So for issues that have not been reported in the autobuilders, what is good is to provide a defconfig that allows to reproduce the problem, so that we can reproduce it again in the future.

Could you look into this, and submit a v2 if relevant?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot