Skip to contentSkip to conversation

Riscv32 gcc bug 93532 workaround

PATCH New Giulio Benetti 2 participants 8 messages Feb 3, 2020 – May 26, 2021

lore
Share & tools
lore
#0 lore raw

cover Riscv32 gcc bug 93532 workaround

Following Microblaze experience on gcc ICE and hangs let's treat the same way Riscv32 gcc bugs. So let's introduce gcc bug already reported and work around failing packages using -O0 optimization flash since no other workarounds worked(disable -g, trying -O1).

Giulio Benetti (3):
toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_93532 package/bullet: fix build failure due to gcc bug 93532 package/lmbench: fix build failure due to gcc bug 93532

 package/bullet/bullet.mk   | 2 +-
 package/lmbench/lmbench.mk | 4 ++++
 toolchain/Config.in        | 8 ++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/3 toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_93532

GCC hangs while building bullet for the Riscv32 Arch:
http://autobuild.buildroot.net/results/9a4/9a405ec6fabfa306c14a671a5e09359ac623c25b/

Reported on gcc bugzilla:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93532

This bug manifests up to version 8.x

---
 toolchain/Config.in | 8 ++++++++
 1 file changed, 8 insertions(+)
toolchain/Config.in +8 -0
index 858121d2c5..1be898731a 100644
@@ -159,6 +159,14 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_90620
 	bool
 	default y if BR2_microblaze
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93532
+# An infinite loop exists on riscv32 gcc. This doesn't manifest on gcc 9.x
+# http://autobuild.buildroot.net/results/9a4/9a405ec6fabfa306c14a671a5e09359ac623c25b/
+config BR2_TOOLCHAIN_HAS_GCC_BUG_93532
+	bool
+	default y if BR2_RISCV_32
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_9
+
 config BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	bool
 
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/3 package/bullet: fix build failure due to gcc bug 93532

In reply to Giulio Benetti

The bullet package exhibits gcc bug 93532 when built for the Riscv32 architecture with optimization enabled, which causes a build to hang.

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

Fixes:
http://autobuild.buildroot.net/results/9a4/9a405ec6fabfa306c14a671a5e09359ac623c25b/

---
 package/bullet/bullet.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/bullet/bullet.mk +1 -1
index b25fc5d219..e13dbba0c6 100644
@@ -25,7 +25,7 @@ endif
 
 BULLET_CXXFLAGS = $(TARGET_CXXFLAGS)
 
-ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180)$(BR2_TOOLCHAIN_HAS_GCC_BUG_93532),y)
 BULLET_CXXFLAGS += -O0
 endif
 
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/3 package/lmbench: fix build failure due to gcc bug 93532

In reply to Giulio Benetti

The lmbench package exhibits gcc bug 93532 when built for the Riscv32 architecture with optimization enabled, which causes a build to hang.

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

Fixes:
http://autobuild.buildroot.net/results/d47/d47e46889d7bcc5864c738cb948afc168327b612/

---
 package/lmbench/lmbench.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/lmbench/lmbench.mk +4 -0
index 2f3b19b5f8..09299a0c17 100644
@@ -28,6 +28,10 @@ define LMBENCH_CONFIGURE_CMDS
 	touch $@
 endef
 
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_93532),y)
+LMBENCH_CFLAGS += -O0
+endif
+
 # Note: there is a second stage 'make' invocation from the 'scripts/build'
 # script. So the variables override below don't take direct effect in
 # src/Makefile.
Signature · 1 line
2.20.1
#4 lore raw

cover Riscv32 gcc bug 93532 workaround

In reply to Giulio Benetti

Hi All,

this bug is shown only if riscv32 gcc is built with -fstack-protector-strong [1], so I don't know if it's better to disable SPP when building gcc for riscv32 version 8.x, or to keep -O0 workaround that is the same as Microblaze.

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93532

Best regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
Quoted 15 lines · Giulio Benetti

Following Microblaze experience on gcc ICE and hangs let's treat the same way Riscv32 gcc bugs. So let's introduce gcc bug already reported and work around failing packages using -O0 optimization flash since no other workarounds worked(disable -g, trying -O1).

Giulio Benetti (3):
toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_93532 package/bullet: fix build failure due to gcc bug 93532 package/lmbench: fix build failure due to gcc bug 93532

  package/bullet/bullet.mk   | 2 +-
  package/lmbench/lmbench.mk | 4 ++++
  toolchain/Config.in        | 8 ++++++++
  3 files changed, 13 insertions(+), 1 deletion(-)
#5 lore raw

cover Riscv32 gcc bug 93532 workaround

Ah, forgot to mention that they provided a patch that solves the problem, so maybe I should provide it as a patch for gcc/8.3.0, right?

Quoted 11 lines · Giulio Benetti

Hi All,

this bug is shown only if riscv32 gcc is built with -fstack-protector-strong [1], so I don't know if it's better to disable SPP when building gcc for riscv32 version 8.x, or to keep -O0 workaround that is the same as Microblaze.

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93532

Best regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
#6 lore raw

cover Riscv32 gcc bug 93532 workaround

In reply to Giulio Benetti

Hi Giulio,

Quoted 9 lines · Giulio Benetti

Following Microblaze experience on gcc ICE and hangs let's treat the same way Riscv32 gcc bugs. So let's introduce gcc bug already reported and work around failing packages using -O0 optimization flash since no other workarounds worked(disable -g, trying -O1).

Giulio Benetti (3):
toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_93532 package/bullet: fix build failure due to gcc bug 93532 package/lmbench: fix build failure due to gcc bug 93532

This series has languished on patchwork for a long time. Since then, we've
updated our autobuilders to GCC 9 for RISCV32 so we no longer see the issue.

Since RISCV is still relatively new, we can kind of assume people will use a
recent toolchain as well.

Therefore, I propose to drop this series rather than introducing complexity
that benefits nobody.

I've marked the series as Rejected in patchwork. Feel free to reopen if there's
a reason to.

Regards,
Arnout

Quoted 6 lines
 package/bullet/bullet.mk   | 2 +-
 package/lmbench/lmbench.mk | 4 ++++
 toolchain/Config.in        | 8 ++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
#7 lore raw

cover Riscv32 gcc bug 93532 workaround

Hi Arnout,

Quoted 16 lines · Arnout Vandecappelle

Hi Giulio,

Quoted 9 lines · Giulio Benetti

Following Microblaze experience on gcc ICE and hangs let's treat the same way Riscv32 gcc bugs. So let's introduce gcc bug already reported and work around failing packages using -O0 optimization flash since no other workarounds worked(disable -g, trying -O1).

Giulio Benetti (3):
toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_93532 package/bullet: fix build failure due to gcc bug 93532 package/lmbench: fix build failure due to gcc bug 93532

This series has languished on patchwork for a long time. Since then, we've
updated our autobuilders to GCC 9 for RISCV32 so we no longer see the issue.

Quoted 8 lines

Since RISCV is still relatively new, we can kind of assume people will use a
recent toolchain as well.

Therefore, I propose to drop this series rather than introducing complexity
that benefits nobody.

I've marked the series as Rejected in patchwork. Feel free to reopen if there's
a reason to.

I totally agree, those bugs never showed up anymore since I've submitted those patches, so it's ok for me.

Thank you

Best regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas