Skip to contentSkip to conversation

treat gcc bug 63261 in a common way

PATCH Superseded Giulio Benetti 2 participants 11 messages May 29, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover treat gcc bug 63261 in a common way

As done for other Gcc bugs introduce and use BR2_TOOLCHAIN_HAS_GCC_BUG_63261 in affected packages:
- fxload
- dmalloc
This is more consistent than checking same conditions for every package and putting a comment on top of it.

Giulio Benetti (3):
toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_63261 package/fxload: re-enable package on Microblaze package/dmalloc: re-enable package on Microblaze

 package/dmalloc/Config.in  | 4 ----
 package/dmalloc/dmalloc.mk | 4 ++++
 package/fxload/Config.in   | 4 ----
 package/fxload/fxload.mk   | 7 ++++++-
 toolchain/Config.in        | 7 +++++++
 5 files changed, 17 insertions(+), 9 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_63261

GCC hangs while building fxload for the Microblaze Arch using following defconfig:
'
BR2_microblazeel=y
BR2_ENABLE_DEBUG=y
BR2_OPTIMIZE_2=y
BR2_KERNEL_HEADERS_5_0=y
BR2_GCC_VERSION_7_X=y
BR2_PACKAGE_FXLOAD=y
'

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

Fixed on Gcc 8.x

---
 toolchain/Config.in | 7 +++++++
 1 file changed, 7 insertions(+)
toolchain/Config.in +7 -0
index 7726ae6fae..f73a5364fc 100644
@@ -113,6 +113,13 @@ config BR2_TOOLCHAIN_SUPPORTS_VARIADIC_MI_THUNK
 	depends on !BR2_or1k
 	depends on !BR2_xtensa
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261. This bug no
+# longer exists in gcc 8.x.
+config BR2_TOOLCHAIN_HAS_GCC_BUG_63261
+	bool
+	default y if BR2_microblaze
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8
+
 # Prior to gcc 7.x, exception_ptr, nested_exception and future from
 # libstdc++ would only be provided on architectures that support
 # always lock-free atomic ints. See
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/3 toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_63261

Hello Giulio,

Thanks for all this work on Microblaze toolchain bugs!

toolchain/Config.in config BR2_TOOLCHAIN_SUPPORTS_VARIADIC_MI_THUNK · line 121

Quoted 6 lines · On Wed, 29 May 2019 15:53:39 +0200 Giulio Benetti…
toolchain/Config.in +6 -0
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261. This bug no
+# longer exists in gcc 8.x.
+config BR2_TOOLCHAIN_HAS_GCC_BUG_63261
+	bool
+	default y if BR2_microblaze
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8

If I understand correctly, this bug only triggers when BR2_ENABLE_DEBUG=y, so this option should have a:

depends on BR2_ENABLE_DEBUG

perhaps ?

Semantically, the toolchain is indeed always affected by bug 63261, but it only manifests itself when BR2_ENABLE_DEBUG=y, and it's easier to have this information in one place (where BR2_TOOLCHAIN_HAS_GCC_BUG_63261) rather than in each package.

Thomas

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

PATCH 1/3 toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_63261

Hello Thomas,

Il 29/05/2019 15:59, Thomas Petazzoni ha scritto:

Quoted 3 lines

Hello Giulio,

Thanks for all this work on Microblaze toolchain bugs!

It's a pleasure and this allows me to lear a lot starting from the base thanks to you all :)

Quoted 13 lines

toolchain/Config.in config BR2_TOOLCHAIN_SUPPORTS_VARIADIC_MI_THUNK · line 121

Quoted 6 lines · On Wed, 29 May 2019 15:53:39 +0200 Giulio Benetti…
toolchain/Config.in +6 -0
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261. This bug no
+# longer exists in gcc 8.x.
+config BR2_TOOLCHAIN_HAS_GCC_BUG_63261
+	bool
+	default y if BR2_microblaze
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8

If I understand correctly, this bug only triggers when BR2_ENABLE_DEBUG=y, so this option should have a:

Quoted 3 lines

depends on BR2_ENABLE_DEBUG

perhaps ?

Oops, yes I've forgotten it, thanks for pointing me that.

Quoted 4 lines

Semantically, the toolchain is indeed always affected by bug 63261, but it only manifests itself when BR2_ENABLE_DEBUG=y, and it's easier to have this information in one place (where BR2_TOOLCHAIN_HAS_GCC_BUG_63261) rather than in each package.

Yes, I'm going to write this ^^^ in cover letter on v2 patchset.

Thanks
Best regards

Signature · 10 lines
Giulio Benetti
CTO

MICRONOVA SRL
Sede: Via A. Niedda 3 - 35010 Vigonza (PD)
Tel. 049/8931563 - Fax 049/8931346
Cod.Fiscale - P.IVA 02663420285
Capitale Sociale ? 26.000 i.v.
Iscritta al Reg. Imprese di Padova N. 02663420285
Numero R.E.A. 258642
#4 lore raw

v2 cover treat gcc bug 63261 in a common way

As done for other Gcc bugs introduce and use BR2_TOOLCHAIN_HAS_GCC_BUG_63261 in affected packages:
- fxload
- dmalloc
This is more consistent than checking same conditions for every package and putting a comment on top of it.

Changes:
V1->V2:
* add 'depends on BR2_ENABLE_DEBUG' to BR2_TOOLCHAIN_HAS_GCC_BUG_63261

Giulio Benetti (3):
toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_63261 package/fxload: re-enable package on Microblaze package/dmalloc: re-enable package on Microblaze

 package/dmalloc/Config.in  | 4 ----
 package/dmalloc/dmalloc.mk | 4 ++++
 package/fxload/Config.in   | 4 ----
 package/fxload/fxload.mk   | 9 ++++++++-
 toolchain/Config.in        | 8 ++++++++
 5 files changed, 20 insertions(+), 9 deletions(-)
Signature · 1 line
2.17.1
#5 lore raw

PATCH v2 1/3 toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_63261

GCC hangs while building fxload for the Microblaze Arch using following defconfig:
'
BR2_microblazeel=y
BR2_ENABLE_DEBUG=y
BR2_OPTIMIZE_2=y
BR2_KERNEL_HEADERS_5_0=y
BR2_GCC_VERSION_7_X=y
BR2_PACKAGE_FXLOAD=y
'

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

Fixed on Gcc 8.x

---
Changes:
V1->V2:
* add 'depends on BR2_ENABLE_DEBUG' to BR2_TOOLCHAIN_HAS_GCC_BUG_63261

 toolchain/Config.in | 8 ++++++++
 1 file changed, 8 insertions(+)
toolchain/Config.in +8 -0
index 2d39ee4039..bf0c950c1f 100644
@@ -113,6 +113,14 @@ config BR2_TOOLCHAIN_SUPPORTS_VARIADIC_MI_THUNK
 	depends on !BR2_or1k
 	depends on !BR2_xtensa
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261. This bug no
+# longer exists in gcc 8.x.
+config BR2_TOOLCHAIN_HAS_GCC_BUG_63261
+	bool
+	default y if BR2_microblaze
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8
+	depends on BR2_ENABLE_DEBUG
+
 # Prior to gcc 7.x, exception_ptr, nested_exception and future from
 # libstdc++ would only be provided on architectures that support
 # always lock-free atomic ints. See
Signature · 1 line
2.17.1
#6 lore raw

PATCH v2 1/3 toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_63261

Got confused.

Il 29/05/2019 16:33, Giulio Benetti ha scritto:

Quoted 30 lines

GCC hangs while building fxload for the Microblaze Arch using following defconfig:
'
BR2_microblazeel=y
BR2_ENABLE_DEBUG=y
BR2_OPTIMIZE_2=y
BR2_KERNEL_HEADERS_5_0=y
BR2_GCC_VERSION_7_X=y
BR2_PACKAGE_FXLOAD=y
'

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

Fixed on Gcc 8.x

---
Changes:
V1->V2:
* add 'depends on BR2_ENABLE_DEBUG' to BR2_TOOLCHAIN_HAS_GCC_BUG_63261

  toolchain/Config.in | 8 ++++++++
  1 file changed, 8 insertions(+)
toolchain/Config.in +0 -0
index 2d39ee4039..bf0c950c1f 100644

toolchain/Config.in config BR2_TOOLCHAIN_SUPPORTS_VARIADIC_MI_THUNK · line 122

Quoted 10 lines
toolchain/Config.in +7 -0
@@ -113,6 +113,14 @@ config BR2_TOOLCHAIN_SUPPORTS_VARIADIC_MI_THUNK
  	depends on !BR2_or1k
  	depends on !BR2_xtensa
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261. This bug no
+# longer exists in gcc 8.x.
+config BR2_TOOLCHAIN_HAS_GCC_BUG_63261
+	bool
+	default y if BR2_microblaze
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8
+	depends on BR2_ENABLE_DEBUG

It fails building fxload without debug symbols, so previous patchset was almost correct, except for defconfig example where I set:
BR2_ENABLE_DEBUG=y

Need to send a v3 patchset with that correct.

Sorry for the noise

Signature · 10 lines
Giulio Benetti
CTO

MICRONOVA SRL
Sede: Via A. Niedda 3 - 35010 Vigonza (PD)
Tel. 049/8931563 - Fax 049/8931346
Cod.Fiscale - P.IVA 02663420285
Capitale Sociale ? 26.000 i.v.
Iscritta al Reg. Imprese di Padova N. 02663420285
Numero R.E.A. 258642
Quoted 4 lines
toolchain/Config.in +0 -0
  # Prior to gcc 7.x, exception_ptr, nested_exception and future from
  # libstdc++ would only be provided on architectures that support
  # always lock-free atomic ints. See
#7 lore raw

PATCH v2 2/3 package/fxload: re-enable package on Microblaze

In reply to Giulio Benetti

With Microblaze Gcc version < 8.x build gives:
'Error: operation combines symbols in different segments' This is due to bug 63261:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261. To avoid this, the fxload package has a !BR2_microblaze dependency. However, gcc bug 63261 only triggers when optimization is enabled, so we can work around the issue by passing -O0, which is what we do in other Buildroot packages to work around this bug.

So, this commit passes -O0 when BR2_TOOLCHAIN_HAS_GCC_BUG_63261, and re-enables fxload on Microblaze.

---
 package/fxload/Config.in | 4 ----
 package/fxload/fxload.mk | 9 ++++++++-
 2 files changed, 8 insertions(+), 5 deletions(-)
package/fxload/Config.in +0 -4
index 88cc6d1e5f..f4d6ef54f5 100644
@@ -1,9 +1,5 @@
 config BR2_PACKAGE_FXLOAD
 	bool "fxload"
-	# Hits gcc PR63261 on Microblaze with debugging symbols
-	# enabled. Since this package is unlikely to be useful on
-	# Microblaze, just disable it on this architecture.
-	depends on !BR2_microblaze
 	help
 	  This program is conveniently able to download firmware into
 	  FX, FX2, and FX2LP EZ-USB devices, as well as the original
package/fxload/fxload.mk +8 -1
index 94b11d0f1e..23c513b1c0 100644
@@ -9,8 +9,15 @@ FXLOAD_SITE = http://downloads.sourceforge.net/project/linux-hotplug/fxload/$(FX
 FXLOAD_LICENSE = GPL-2.0+
 FXLOAD_LICENSE_FILES = COPYING
 
+FXLOAD_CFLAGS = $(TARGET_CFLAGS)
+
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_63261),y)
+FXLOAD_CFLAGS += -O0
+endif
+
 define FXLOAD_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) all
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
+	CFLAGS="$(FXLOAD_CFLAGS)" -C $(@D) all
 endef
 
 define FXLOAD_INSTALL_TARGET_CMDS
Signature · 1 line
2.17.1
#8 lore raw

PATCH v2 3/3 package/dmalloc: re-enable package on Microblaze

In reply to Giulio Benetti

With Microblaze Gcc version < 8.x build gives:
'Error: operation combines symbols in different segments' This is due to bug 63261:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261. To avoid this, the dmalloc package has a !BR2_microblaze dependency. However, gcc bug 63261 only triggers when optimization is enabled, so we can work around the issue by passing -O0, which is what we do in other Buildroot packages to work around this bug.

So, this commit passes -O0 when BR2_TOOLCHAIN_HAS_GCC_BUG_63261, and re-enables dmalloc on Microblaze.

---
 package/dmalloc/Config.in  | 4 ----
 package/dmalloc/dmalloc.mk | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)
package/dmalloc/Config.in +0 -4
index e5be109332..0c01970b04 100644
@@ -1,9 +1,5 @@
 config BR2_PACKAGE_DMALLOC
 	bool "dmalloc"
-	# On some packages, Microblaze gcc has issues when debugging
-	# symbols are enabled: "Error: operation combines symbols in
-	# different segments".
-	depends on !(BR2_microblaze && BR2_ENABLE_DEBUG)
 	help
 	  A debug memory allocation library which is a drop in
 	  replacement for the system's malloc, realloc, calloc, free and
package/dmalloc/dmalloc.mk +4 -0
index 6ebb44c5c0..38b2c02027 100644
@@ -35,6 +35,10 @@ ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
 DMALLOC_CFLAGS += -marm
 endif
 
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_63261),y)
+DMALLOC_CFLAGS += -O0
+endif
+
 DMALLOC_CONF_ENV = CFLAGS="$(DMALLOC_CFLAGS)"
 
 define DMALLOC_POST_PATCH
Signature · 1 line
2.17.1
#9 lore raw

PATCH 2/3 package/fxload: re-enable package on Microblaze

In reply to Giulio Benetti

With Microblaze Gcc version < 8.x build gives:
'Error: operation combines symbols in different segments' This is due to bug 63261:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261. To avoid this, the fxload package has a !BR2_microblaze dependency. However, gcc bug 63261 only triggers when optimization is enabled, so we can work around the issue by passing -O0, which is what we do in other Buildroot packages to work around this bug.

So, this commit passes -O0 when BR2_TOOLCHAIN_HAS_GCC_BUG_63261, and re-enables fxload on Microblaze.

---
 package/fxload/Config.in | 4 ----
 package/fxload/fxload.mk | 7 ++++++-
 2 files changed, 6 insertions(+), 5 deletions(-)
package/fxload/Config.in +0 -4
index 88cc6d1e5f..f4d6ef54f5 100644
@@ -1,9 +1,5 @@
 config BR2_PACKAGE_FXLOAD
 	bool "fxload"
-	# Hits gcc PR63261 on Microblaze with debugging symbols
-	# enabled. Since this package is unlikely to be useful on
-	# Microblaze, just disable it on this architecture.
-	depends on !BR2_microblaze
 	help
 	  This program is conveniently able to download firmware into
 	  FX, FX2, and FX2LP EZ-USB devices, as well as the original
package/fxload/fxload.mk +6 -1
index 94b11d0f1e..213e291600 100644
@@ -9,8 +9,13 @@ FXLOAD_SITE = http://downloads.sourceforge.net/project/linux-hotplug/fxload/$(FX
 FXLOAD_LICENSE = GPL-2.0+
 FXLOAD_LICENSE_FILES = COPYING
 
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_63261),y)
+FXLOAD_CFLAGS += $(TARGET_CFLAGS) -O0
+endif
+
 define FXLOAD_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) all
+	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) \
+	CFLAGS="$(FXLOAD_CFLAGS)" -C $(@D) all
 endef
 
 define FXLOAD_INSTALL_TARGET_CMDS
Signature · 1 line
2.17.1
#10 lore raw

PATCH 3/3 package/dmalloc: re-enable package on Microblaze

In reply to Giulio Benetti

With Microblaze Gcc version < 8.x build gives:
'Error: operation combines symbols in different segments' This is due to bug 63261:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63261. To avoid this, the dmalloc package has a !BR2_microblaze dependency. However, gcc bug 63261 only triggers when optimization is enabled, so we can work around the issue by passing -O0, which is what we do in other Buildroot packages to work around this bug.

So, this commit passes -O0 when BR2_TOOLCHAIN_HAS_GCC_BUG_63261, and re-enables dmalloc on Microblaze.

---
 package/dmalloc/Config.in  | 4 ----
 package/dmalloc/dmalloc.mk | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)
package/dmalloc/Config.in +0 -4
index e5be109332..0c01970b04 100644
@@ -1,9 +1,5 @@
 config BR2_PACKAGE_DMALLOC
 	bool "dmalloc"
-	# On some packages, Microblaze gcc has issues when debugging
-	# symbols are enabled: "Error: operation combines symbols in
-	# different segments".
-	depends on !(BR2_microblaze && BR2_ENABLE_DEBUG)
 	help
 	  A debug memory allocation library which is a drop in
 	  replacement for the system's malloc, realloc, calloc, free and
package/dmalloc/dmalloc.mk +4 -0
index 6ebb44c5c0..da03373879 100644
@@ -35,6 +35,10 @@ ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
 DMALLOC_CFLAGS += -marm
 endif
 
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_63261),y)
+DMALLOC_CFLAGS=-O0
+endif
+
 DMALLOC_CONF_ENV = CFLAGS="$(DMALLOC_CFLAGS)"
 
 define DMALLOC_POST_PATCH
Signature · 1 line
2.17.1