Skip to contentSkip to conversation

Deal with binutils bug 21464

PATCH New Giulio Benetti 3 participants 17 messages Mar 5, 2021 – Mar 22, 2021

lore
Share & tools
lore
#0 lore raw

v2 cover Deal with binutils bug 21464

Introduce binutils bug which protobuf and zeromq package are affected and disable them while suffering that bug.

Giulio Benetti (3):
toolchain: introduce BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464 package/protobuf: disable package if binutils is affected from bug

    21464

package/zeromq: disable package if binutils is affected from bug 21464

 package/protobuf/Config.in | 1 +
 package/zeromq/Config.in   | 2 ++
 toolchain/Config.in        | 6 ++++++
 3 files changed, 9 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/3 toolchain: introduce BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464

On OpenRisc binutils it still present ld bug 21464 leading to a package protobuf to fail building:
http://autobuild.buildroot.net/results/908/9084cd777aefe0fa8235514c33767d8640ad7a5b/

The bug was already reported and it's been updated:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

---
 toolchain/Config.in | 6 ++++++
 1 file changed, 6 insertions(+)
toolchain/Config.in +6 -0
index 553612c4aa..d181644f98 100644
@@ -81,6 +81,12 @@ config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_19615
 config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_20006
 	bool
 
+# https://sourceware.org/bugzilla/show_bug.cgi?id=21464
+# Affect toolchains built with binutils 2.31.1, still not fixed.
+config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464
+	bool
+	default y if BR2_or1k
+
 # Atomic types can be:
 #  - never lock-free
 #  - sometimes lock-free
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 1/3 toolchain: introduce BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464

Quoted 11 lines · On Fri, 5 Mar 2021 17:12:09 +0100 Giulio Benetti…

On OpenRisc binutils it still present ld bug 21464 leading to a package protobuf to fail building:
http://autobuild.buildroot.net/results/908/9084cd777aefe0fa8235514c33767d8640ad7a5b/

The bug was already reported and it's been updated:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

---
 toolchain/Config.in | 6 ++++++
 1 file changed, 6 insertions(+)

Applied to master with a reworked commit log.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH v2 1/3 toolchain: introduce BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464

In reply to Giulio Benetti
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Giulio" == Giulio Benetti <[email protected]> writes:

On OpenRisc binutils it still present ld bug 21464 leading to a package protobuf to fail building:
http://autobuild.buildroot.net/results/908/9084cd777aefe0fa8235514c33767d8640ad7a5b/

The bug was already reported and it's been updated:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

Committed to 2020.02.x, 2020.11.x and 2021.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH v2 2/3 package/protobuf: disable package if binutils is affected from bug 21464

In reply to Giulio Benetti

This package is affected from binutils bug 21464, since there is no workaround, let's disable it.

Fixes:
http://autobuild.buildroot.net/results/908/9084cd777aefe0fa8235514c33767d8640ad7a5b/

---
 package/protobuf/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/protobuf/Config.in +1 -0
index 46c820b9cf..30050950aa 100644
@@ -24,6 +24,7 @@ config BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS
 	default y if BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
 	depends on BR2_USE_MMU # fork()
+	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464
 
 config BR2_PACKAGE_PROTOBUF
 	bool "protobuf"
Signature · 1 line
2.25.1
#5 lore raw

PATCH v2 2/3 package/protobuf: disable package if binutils is affected from bug 21464

Quoted 10 lines · On Fri, 5 Mar 2021 17:12:10 +0100 Giulio Benetti…

This package is affected from binutils bug 21464, since there is no workaround, let's disable it.

Fixes:
http://autobuild.buildroot.net/results/908/9084cd777aefe0fa8235514c33767d8640ad7a5b/

---
 package/protobuf/Config.in | 1 +
 1 file changed, 1 insertion(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

PATCH v2 2/3 package/protobuf: disable package if binutils is affected from bug 21464

In reply to Giulio Benetti
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Giulio" == Giulio Benetti <[email protected]> writes:

This package is affected from binutils bug 21464, since there is no workaround, let's disable it.

Fixes:
http://autobuild.buildroot.net/results/908/9084cd777aefe0fa8235514c33767d8640ad7a5b/

Committed to 2020.02.x, 2020.11.x and 2021.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH v2 3/3 package/zeromq: disable package if binutils is affected from bug 21464

In reply to Giulio Benetti

This package is affected from binutils bug 21464, since there is no workaround, let's disable it.

Fixes:
http://autobuild.buildroot.net/results/ce351e0e97c2cacc17d4718d39941548c7558559

---
 package/zeromq/Config.in | 2 ++
 1 file changed, 2 insertions(+)
package/zeromq/Config.in +2 -0
index cf5c644c39..f99adf7acc 100644
@@ -1,10 +1,12 @@
 comment "zeromq needs a toolchain w/ C++, threads"
 	depends on !(BR2_INSTALL_LIBSTDCPP && BR2_TOOLCHAIN_HAS_THREADS)
+	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464
 
 config BR2_PACKAGE_ZEROMQ
 	bool "zeromq"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464
 	select BR2_PACKAGE_UTIL_LINUX
 	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
 	help
Signature · 1 line
2.25.1
#8 lore raw

PATCH v2 3/3 package/zeromq: disable package if binutils is affected from bug 21464

package/zeromq/Config.in line 9

Quoted 5 lines · On Fri, 5 Mar 2021 17:12:11 +0100 Giulio Benetti…

config BR2_PACKAGE_ZEROMQ

package/zeromq/Config.in +1 -0
 	bool "zeromq"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464

This is not sufficient: there are numerous packages that "select BR2_PACKAGE_ZEROMQ", so this "depends on" would have to be propagated.

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

PATCH v2 3/3 package/zeromq: disable package if binutils is affected from bug 21464

Quoted 11 lines · Thomas Petazzoni

Review

Quoted 5 lines · On Fri, 5 Mar 2021 17:12:11 +0100 Giulio Benetti…

config BR2_PACKAGE_ZEROMQ
bool "zeromq"
depends on BR2_INSTALL_LIBSTDCPP
depends on BR2_TOOLCHAIN_HAS_THREADS

(quoted diff) +1 -0
+	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464

This is not sufficient: there are numerous packages that "select BR2_PACKAGE_ZEROMQ", so this "depends on" would have to be propagated.

Oh, again forgotten about Kconfig dependencies, I'm going to fix this and the other patches too.

Thanks for reviewing.

Best regards

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

PATCH v2 3/3 package/zeromq: disable package if binutils is affected from bug 21464

Quoted 5 lines · On Sun, 14 Mar 2021 22:45:07 +0100 Giulio Benetti…
Quoted 2 lines

This is not sufficient: there are numerous packages that "select BR2_PACKAGE_ZEROMQ", so this "depends on" would have to be propagated.

Oh, again forgotten about Kconfig dependencies, I'm going to fix this and the other patches too.

But it's annoying to propagate all those depends on... It would be so much nicer to have a workaround for those bugs.

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#11 lore raw

PATCH 1/1 package/zeromq: fix build failure due to binutils bug 21464

In reply to Thomas Petazzoni

The zeromq package exhibits binutils bug 21464 when built for the Nios2 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_BINUTILS_BUG_21464=y.

Fixes:
http://autobuild.buildroot.net/results/ce351e0e97c2cacc17d4718d39941548c7558559

---
 package/zeromq/zeromq.mk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
package/zeromq/zeromq.mk +9 -1
index 182699403c..135b07b6c6 100644
@@ -23,12 +23,20 @@ ZEROMQ_CONF_ENV = libzmq_cv_sock_cloexec=yes \
 	libzmq_cv_tcp_keepidle=yes \
 	libzmq_cv_tcp_keepintvl=yes
 
+ZEROMQ_CXXFLAGS = $(TARGET_CXXFLAGS)
+
 # Internal error, aborting at dwarf2cfi.c:2752 in connect_traces
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58864
 ifeq ($(BR2_m68k_cf),y)
-ZEROMQ_CONF_OPTS += CXXFLAGS="$(TARGET_CXXFLAGS) -fno-defer-pop"
+ZEROMQ_CXXFLAGS += -fno-defer-pop
+endif
+
+ifeq ($(BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464),y)
+ZEROMQ_CXXFLAGS += -O0
 endif
 
+ZEROMQ_CONF_OPTS += CXXFLAGS="$(ZEROMQ_CXXFLAGS)"
+
 # Only tools/curve_keygen.c needs this, but it doesn't hurt to pass it
 # for the rest of the build as well (which automatically includes stdc++).
 ifeq ($(BR2_STATIC_LIBS),y)
Signature · 1 line
2.25.1
#12 lore raw

PATCH 1/1 package/zeromq: fix build failure due to binutils bug 21464

Hi Thomas,

Quoted 31 lines · Giulio Benetti

The zeromq package exhibits binutils bug 21464 when built for the Nios2 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_BINUTILS_BUG_21464=y.

Fixes:
http://autobuild.buildroot.net/results/ce351e0e97c2cacc17d4718d39941548c7558559

---
  package/zeromq/zeromq.mk | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
package/zeromq/zeromq.mk +4 -1
index 182699403c..135b07b6c6 100644
@@ -23,12 +23,20 @@ ZEROMQ_CONF_ENV = libzmq_cv_sock_cloexec=yes \
  	libzmq_cv_tcp_keepidle=yes \
  	libzmq_cv_tcp_keepintvl=yes
 
+ZEROMQ_CXXFLAGS = $(TARGET_CXXFLAGS)
+
  # Internal error, aborting at dwarf2cfi.c:2752 in connect_traces
  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58864
  ifeq ($(BR2_m68k_cf),y)
-ZEROMQ_CONF_OPTS += CXXFLAGS="$(TARGET_CXXFLAGS) -fno-defer-pop"
+ZEROMQ_CXXFLAGS += -fno-defer-pop
+endif

package/zeromq/zeromq.mk ZEROMQ_CONF_ENV = libzmq_cv_sock_cloexec=yes \ · line 42

Quoted 10 lines
package/zeromq/zeromq.mk +5 -0
+
+ifeq ($(BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464),y)
+ZEROMQ_CXXFLAGS += -O0
  endif
 
+ZEROMQ_CONF_OPTS += CXXFLAGS="$(ZEROMQ_CXXFLAGS)"
+
  # Only tools/curve_keygen.c needs this, but it doesn't hurt to pass it
  # for the rest of the build as well (which automatically includes stdc++).
  ifeq ($(BR2_STATIC_LIBS),y)

this patch works around binutils bug 21464 for this package. The other packages affected by binutils bug 21464 seem affected by another bug instead and at the moment can't be worked around, I'll try to find a possible work around.

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

PATCH 1/1 package/zeromq: fix build failure due to binutils bug 21464

Hi Thomas,

Quoted 38 lines · Giulio Benetti

Hi Thomas,

Quoted 35 lines · Giulio Benetti

The zeromq package exhibits binutils bug 21464 when built for the Nios2 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_BINUTILS_BUG_21464=y.

Fixes:
http://autobuild.buildroot.net/results/ce351e0e97c2cacc17d4718d39941548c7558559

---
   package/zeromq/zeromq.mk | 10 +++++++++-
   1 file changed, 9 insertions(+), 1 deletion(-)
package/zeromq/zeromq.mk +7 -1
index 182699403c..135b07b6c6 100644
@@ -23,12 +23,20 @@ ZEROMQ_CONF_ENV = libzmq_cv_sock_cloexec=yes \
   	libzmq_cv_tcp_keepidle=yes \
   	libzmq_cv_tcp_keepintvl=yes
 
+ZEROMQ_CXXFLAGS = $(TARGET_CXXFLAGS)
+
   # Internal error, aborting at dwarf2cfi.c:2752 in connect_traces
   # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58864
   ifeq ($(BR2_m68k_cf),y)
-ZEROMQ_CONF_OPTS += CXXFLAGS="$(TARGET_CXXFLAGS) -fno-defer-pop"
+ZEROMQ_CXXFLAGS += -fno-defer-pop
+endif
+
+ifeq ($(BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464),y)
+ZEROMQ_CXXFLAGS += -O0
   endif
 
Quoted 12 lines

package/zeromq/zeromq.mk ZEROMQ_CONF_ENV = libzmq_cv_sock_cloexec=yes \ · line 42

Quoted 6 lines
package/zeromq/zeromq.mk +2 -0
+ZEROMQ_CONF_OPTS += CXXFLAGS="$(ZEROMQ_CXXFLAGS)"
+
   # Only tools/curve_keygen.c needs this, but it doesn't hurt to pass it
   # for the rest of the build as well (which automatically includes stdc++).
   ifeq ($(BR2_STATIC_LIBS),y)

this patch works around binutils bug 21464 for this package. The other packages affected by binutils bug 21464 seem affected by another bug instead and at the moment can't be worked around, I'll try to find a possible work around.

OpenRisc binutils 21464 bug has a fix:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

I've tested it with binutils:
- 2.32
- 2.34
- 2.35.2
- 2.36.1

and works good while building:
- protobuf
- libtheora
- zeromq

zeromq is the only package that could be worked around with -O0.

I would add patches that add patches to all binutils versions, so this way buildroot toolchain built by buildroot are safe, but I should tag as buggy all the external openrisc toolchains, basically the one provided by Bootlin. This implies adding patches to disable building libtheora with all its dependencies and I can do it, or otherwise we can wait for Bootlin to release a new fixed openrisc toolchain, what about that?

Also, zeromq is worked around using -O0 by this:
https://patchwork.ozlabs.org/project/buildroot/patch/20210317154520.1613272-1-giulio.benetti at benettiengineering.com/

protobuf has already been disabled by this:
https://git.buildroot.net/buildroot/commit/?id=9e71b6e2cb28a66e116019bf8808fb48cef1d7b9

libtheora needs a new patch taking care of dependencies.

In the meanwhile I've provided patch with the fix for binutils:
https://patchwork.ozlabs.org/project/buildroot/patch/20210322131437.392225-1-giulio.benetti at benettiengineering.com/

Best regards

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

PATCH 1/1 package/zeromq: fix build failure due to binutils bug 21464

Quoted 9 lines · On Mon, 22 Mar 2021 14:15:08 +0100 Giulio Benetti…

OpenRisc binutils 21464 bug has a fix:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

I've tested it with binutils:
- 2.32
- 2.34
- 2.35.2
- 2.36.1

Quoted 4 lines

and works good while building:
- protobuf
- libtheora
- zeromq

Excellent! Thanks for all this work!

Has this fix been suggested by upstream? How do you know it's the "right" fix ?

Quoted 8 lines

zeromq is the only package that could be worked around with -O0.

I would add patches that add patches to all binutils versions, so this way buildroot toolchain built by buildroot are safe, but I should tag as buggy all the external openrisc toolchains, basically the one provided by Bootlin. This implies adding patches to disable building libtheora with all its dependencies and I can do it, or otherwise we can wait for Bootlin to release a new fixed openrisc toolchain, what about that?

Don't bother with the external Bootlin toolchains, I was working on a new release of the toolchains based on 2021.02, so I'll include the binutils fix.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#15 lore raw

PATCH 1/1 package/zeromq: fix build failure due to binutils bug 21464

Quoted 12 lines · Thomas Petazzoni
Quoted 9 lines · On Mon, 22 Mar 2021 14:15:08 +0100 Giulio Benetti…

OpenRisc binutils 21464 bug has a fix:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

I've tested it with binutils:
- 2.32
- 2.34
- 2.35.2
- 2.36.1

Quoted 8 lines
Quoted 4 lines

and works good while building:
- protobuf
- libtheora
- zeromq

Excellent! Thanks for all this work!

Has this fix been suggested by upstream? How do you know it's the "right" fix ?

Yes it's been suggested by Stafford here:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

Quoted 9 lines
Quoted 8 lines

zeromq is the only package that could be worked around with -O0.

I would add patches that add patches to all binutils versions, so this way buildroot toolchain built by buildroot are safe, but I should tag as buggy all the external openrisc toolchains, basically the one provided by Bootlin. This implies adding patches to disable building libtheora with all its dependencies and I can do it, or otherwise we can wait for Bootlin to release a new fixed openrisc toolchain, what about that?

Quoted 3 lines

Don't bother with the external Bootlin toolchains, I was working on a new release of the toolchains based on 2021.02, so I'll include the binutils fix.

Ok, so it fixes this bug for Buildroot toolchain and you'll provide Bootlin toolchain and we can consider this bug as not affecting Buildroot anymore. The chance one would use an external OpenRisc toolchain would be very rare. Right?

Then we could revert commit:
"package/protobuf: disable package if binutils is affected from bug 21464"
https://git.buildroot.net/buildroot/commit/?id=9e71b6e2cb

While doing all these tests I've gound that libgeos still has this bug and most of all, the diff proposed doesn't fix bug 21464, they are 2 different bugs, so I've updated that here:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

And submitted the other bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=27624

So bug 21464 is still there and my binutils patches need do be re-worded.

And please drop my pending patch:
https://patchwork.ozlabs.org/project/buildroot/patch/20210322131437.392225-1-giulio.benetti at benettiengineering.com/

I've submitted a reworded one:
https://patchwork.ozlabs.org/project/buildroot/patch/20210322155655.547476-1-giulio.benetti at benettiengineering.com/

Best regards

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

PATCH 1/1 package/zeromq: fix build failure due to binutils bug 21464

Quoted 5 lines · On Mon, 22 Mar 2021 16:57:23 +0100 Giulio Benetti…
Quoted 2 lines

Has this fix been suggested by upstream? How do you know it's the "right" fix ?

Yes it's been suggested by Stafford here:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

Ah, OK!

Quoted 8 lines
Quoted 3 lines

Don't bother with the external Bootlin toolchains, I was working on a new release of the toolchains based on 2021.02, so I'll include the binutils fix.

Ok, so it fixes this bug for Buildroot toolchain and you'll provide Bootlin toolchain and we can consider this bug as not affecting Buildroot anymore. The chance one would use an external OpenRisc toolchain would be very rare. Right?

Yes, that's the idea.

Quoted 7 lines

So bug 21464 is still there and my binutils patches need do be re-worded.

And please drop my pending patch:
https://patchwork.ozlabs.org/project/buildroot/patch/20210322131437.392225-1-giulio.benetti at benettiengineering.com/

I've submitted a reworded one:
https://patchwork.ozlabs.org/project/buildroot/patch/20210322155655.547476-1-giulio.benetti at benettiengineering.com/

OK, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com