Skip to contentSkip to conversation

Microblaze gcc bug 97208

PATCH In review Giulio Benetti 2 participants 9 messages Aug 13, 2021 – Aug 14, 2021

lore
Share & tools
lore
#0 lore raw

cover Microblaze gcc bug 97208

This patchset introduce gcc bug 97208 to workaround build failure of lmbench on Microblaze. But let's also use it for toolchain-wrapper to make it more consitent.

Giulio Benetti (3):
toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_97208 toolchain/toolchain-wrapper: use Gcc bug 97208 instead of repeating it package/lmbench: fix build failure due to gcc bug 97208

 package/lmbench/lmbench.mk     | 4 ++++
 toolchain/Config.in            | 7 +++++++
 toolchain/toolchain-wrapper.mk | 5 ++---
 3 files changed, 13 insertions(+), 3 deletions(-)
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/3 toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_97208

lmbench package fails to build for the Microblaze architecture with optimization enabled with gcc = 11.1.0:
http://autobuild.buildroot.net/results/ae1/ae1e4d61ed367c6cb64442c60d98882cc7985346/

It's been reported upstream by Romain Naour:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97208

---
 toolchain/Config.in | 7 +++++++
 1 file changed, 7 insertions(+)
toolchain/Config.in +7 -0
index 3888eeafe2..1dae0cb2cc 100644
@@ -163,6 +163,13 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_93847
 	bool
 	default y if BR2_nios2 && !BR2_TOOLCHAIN_GCC_AT_LEAST_9
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97208
+# ICE: in extract_insn, at recog.c:2294 on microblaze.
+# This bug still exists in gcc = 11.1.0
+config BR2_TOOLCHAIN_HAS_GCC_BUG_97208
+	bool
+	default y if BR2_microblaze
+
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99410
 # Error: branch offset out of range on Nios II. This bug
 # no longer exists in gcc >= 9.x.
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 1/3] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_97208

Hi,

Quoted 4 lines

Il giorno 13 ago 2021, alle ore 23:38, Giulio Benetti <[email protected]> ha scritto:

lmbench package fails to build for the Microblaze architecture with optimization enabled with gcc = 11.1.0:

^^^ ‘gcc <= 11’, not only =

Quoted 32 lines

http://autobuild.buildroot.net/results/ae1/ae1e4d61ed367c6cb64442c60d98882cc7985346/

It's been reported upstream by Romain Naour:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97208

---
toolchain/Config.in | 7 +++++++

1 file changed, 7 insertions(+)
toolchain/Config.in +7 -0
index 3888eeafe2..1dae0cb2cc 100644
@@ -163,6 +163,13 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_93847
   bool
   default y if BR2_nios2 && !BR2_TOOLCHAIN_GCC_AT_LEAST_9
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97208
+# ICE: in extract_insn, at recog.c:2294 on microblaze.
+# This bug still exists in gcc = 11.1.0
+config BR2_TOOLCHAIN_HAS_GCC_BUG_97208
+    bool
+    default y if BR2_microblaze
+
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99410
 # Error: branch offset out of range on Nios II. This bug
 # no longer exists in gcc >= 9.x.
Signature · 1 line
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

Re: [Buildroot] [PATCH 1/3] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_97208

Please drop this patch, I've already set it as Rejected in Patchwork. Sorry for the noise

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

Hi,

Quoted 4 lines

Il giorno 13 ago 2021, alle ore 23:38, Giulio Benetti <[email protected]> ha scritto:

lmbench package fails to build for the Microblaze architecture with optimization enabled with gcc = 11.1.0:

^^^ ‘gcc <= 11’, not only =

Quoted 29 lines

http://autobuild.buildroot.net/results/ae1/ae1e4d61ed367c6cb64442c60d98882cc7985346/

It's been reported upstream by Romain Naour:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97208

---
toolchain/Config.in | 7 +++++++

1 file changed, 7 insertions(+)
toolchain/Config.in +7 -0
index 3888eeafe2..1dae0cb2cc 100644
@@ -163,6 +163,13 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_93847
    bool
    default y if BR2_nios2 && !BR2_TOOLCHAIN_GCC_AT_LEAST_9
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97208
+# ICE: in extract_insn, at recog.c:2294 on microblaze.
+# This bug still exists in gcc = 11.1.0
+config BR2_TOOLCHAIN_HAS_GCC_BUG_97208
+    bool
+    default y if BR2_microblaze
+
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99410
 # Error: branch offset out of range on Nios II. This bug
 # no longer exists in gcc >= 9.x.
Quoted 9 lines
Quoted 3 lines
Signature · 1 line
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw

PATCH 2/3 toolchain/toolchain-wrapper: use Gcc bug 97208 instead of repeating it

In reply to Giulio Benetti

Now that we have added Gcc bug 97208 we can use it instead of repeating it. So let's substitute bug condition with bug presence. Also note that gcc bug 97208 is still present in gcc 11.1.0 so better to make comment more generic and keep a detailed description in toolchain/Config.in

---
 toolchain/toolchain-wrapper.mk | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
toolchain/toolchain-wrapper.mk +2 -3
index 8b551e3a18..c56ec7c054 100644
@@ -33,11 +33,10 @@ TOOLCHAIN_WRAPPER_OPTS += -DBR_NEED_SOURCE_DATE_EPOCH
 endif
 endif
 
-# Disable -ftree-loop-distribute-patterns on microblaze to
-# workaround a compiler bug with gcc 10 and -O2, -Os or -O3.
+# Disable -ftree-loop-distribute-patterns on compiler affected by gcc bug 97208.
 # https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=5879ab5fafedc8f6f9bfe95a4cf8501b0df90edd
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97208
-ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_10)$(BR2_microblaze),yy)
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_97208),y)
 TOOLCHAIN_WRAPPER_OPTS += -fno-tree-loop-distribute-patterns
 endif
 
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
#5 lore raw

Re: [Buildroot] [PATCH 2/3] toolchain/toolchain-wrapper: use Gcc bug 97208 instead of repeating it

Please drop this patch, I've already set it as Rejected in Patchwork. Sorry for the noise

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

Now that we have added Gcc bug 97208 we can use it instead of repeating it. So let's substitute bug condition with bug presence. Also note that gcc bug 97208 is still present in gcc 11.1.0 so better to make comment more generic and keep a detailed description in toolchain/Config.in

---
  toolchain/toolchain-wrapper.mk | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
toolchain/toolchain-wrapper.mk +0 -0
index 8b551e3a18..c56ec7c054 100644
@@ -33,11 +33,10 @@ TOOLCHAIN_WRAPPER_OPTS += -DBR_NEED_SOURCE_DATE_EPOCH
  endif
  endif
 

toolchain/toolchain-wrapper.mk TOOLCHAIN_WRAPPER_OPTS += -DBR_NEED_SOURCE_DATE_EPOCH · line 42

Quoted 10 lines
toolchain/toolchain-wrapper.mk +2 -3
-# Disable -ftree-loop-distribute-patterns on microblaze to
-# workaround a compiler bug with gcc 10 and -O2, -Os or -O3.
+# Disable -ftree-loop-distribute-patterns on compiler affected by gcc bug 97208.
  # https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=5879ab5fafedc8f6f9bfe95a4cf8501b0df90edd
  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97208
-ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_10)$(BR2_microblaze),yy)
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_97208),y)
  TOOLCHAIN_WRAPPER_OPTS += -fno-tree-loop-distribute-patterns
  endif
 

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#6 lore raw

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

In reply to Giulio Benetti

The lmbench package exhibits gcc bug 97208 when built for the Microblaze 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_97208=y..

Fixes:
http://autobuild.buildroot.net/results/ae1/ae1e4d61ed367c6cb64442c60d98882cc7985346/

---
 package/lmbench/lmbench.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/lmbench/lmbench.mk +4 -0
index 2f3b19b5f8..8e16c7112f 100644
@@ -18,6 +18,10 @@ LMBENCH_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`
 LMBENCH_LDLIBS = `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`
 endif
 
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_97208),y)
+LMBENCH_CFLAGS += -O0
+endif
+
 LMBENCH_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
 
 define LMBENCH_CONFIGURE_CMDS
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
#7 lore raw

Re: [Buildroot] [PATCH 3/3] package/lmbench: fix build failure due to gcc bug 97208

Hello Giulio,

Quoted 10 lines · On Fri, 13 Aug 2021 23:37:45 +0200 Giulio Benetti…

The lmbench package exhibits gcc bug 97208 when built for the Microblaze 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_97208=y..

Fixes:
http://autobuild.buildroot.net/results/ae1/ae1e4d61ed367c6cb64442c60d98882cc7985346/

Are we sure the gcc bug is the same? According to the word-around in toolchain wrapper, disabling the -ftree-loop-distribute-patterns is enough... but not for lmbench ?

What specifically tells us that the lmbench issue is the same as the one we worked-around with -fnotree-loop-distribute-patterns in other packages ?

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
#8 lore raw

Re: [Buildroot] [PATCH 3/3] package/lmbench: fix build failure due to gcc bug 97208

Hello Thomas,

Quoted 16 lines · Thomas Petazzoni

Hello Giulio,

Quoted 10 lines · On Fri, 13 Aug 2021 23:37:45 +0200 Giulio Benetti…

The lmbench package exhibits gcc bug 97208 when built for the Microblaze 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_97208=y..

Fixes:
http://autobuild.buildroot.net/results/ae1/ae1e4d61ed367c6cb64442c60d98882cc7985346/

Quoted 7 lines

Are we sure the gcc bug is the same? According to the word-around in toolchain wrapper, disabling the -ftree-loop-distribute-patterns is enough... but not for lmbench ?

What specifically tells us that the lmbench issue is the same as the one we worked-around with -fnotree-loop-distribute-patterns in other packages ?

You're right, I've been biased by the fact that they fail on the same gcc versions and that's all. I don't know why I've ended up to this conclusion honestly.

So, I've filed a new gcc bug into gcc bugzilla[1] and treat it with -O0 since I've given a try with -fnotree-loop-distribute-patterns with no luck. Then I'll send a patch to work around gcc bug 101915 on lmbench.

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

Signature · 6 lines
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot