All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] Add and workaround gcc bug 83143
@ 2021-08-27 22:34 Giulio Benetti
  2021-08-27 22:34 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
  2021-08-27 22:34 ` [Buildroot] [PATCH 2/2] package/ruby: fix build failure due to gcc bug 83143 Giulio Benetti
  0 siblings, 2 replies; 13+ messages in thread
From: Giulio Benetti @ 2021-08-27 22:34 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Thomas De Schampheleire

This patchset add gcc bug 83143 and work it around for package ruby with
a more specific CFLAG instead of the classic -O0. The work around has been
suggested here[1] and saves lot of memory since here ruby is the package
affected by this bug and it's pretty big.

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

Giulio Benetti (2):
  toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
  package/ruby: fix build failure due to gcc bug 83143

 package/ruby/ruby.mk | 8 ++++++++
 toolchain/Config.in  | 9 +++++++++
 2 files changed, 17 insertions(+)

-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
  2021-08-27 22:34 [Buildroot] [PATCH 0/2] Add and workaround gcc bug 83143 Giulio Benetti
@ 2021-08-27 22:34 ` Giulio Benetti
  2021-08-28 12:06   ` Arnout Vandecappelle
  2021-08-27 22:34 ` [Buildroot] [PATCH 2/2] package/ruby: fix build failure due to gcc bug 83143 Giulio Benetti
  1 sibling, 1 reply; 13+ messages in thread
From: Giulio Benetti @ 2021-08-27 22:34 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Thomas De Schampheleire

ruby package fails to build for the SH4 architecture with optimization
enabled with gcc = 9.3.0:
http://autobuild.buildroot.net/results/f57/f5742e7fb6e8142bcdb53b7f4f5e9c1bea3558cd/

It's already been reported upstream:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 toolchain/Config.in | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/toolchain/Config.in b/toolchain/Config.in
index bf2bb3efe4..4419443930 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -133,6 +133,15 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
 	bool
 	default y if BR2_microblaze
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
+# Error: invalid operands (*UND* and .text sections) for `-' on sh4.
+# This bug no longer exists in gcc 10.x but reappeared on gcc 11.x and
+# it still not been fixed yet.
+config BR2_TOOLCHAIN_HAS_GCC_BUG_83143
+	bool
+	default y if !BR2_TOOLCHAIN_GCC_AT_LEAST_10
+	depends on BR2_sh4
+
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85180. This bug no
 # longer exists in gcc 8.x.
 config BR2_TOOLCHAIN_HAS_GCC_BUG_85180
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 2/2] package/ruby: fix build failure due to gcc bug 83143
  2021-08-27 22:34 [Buildroot] [PATCH 0/2] Add and workaround gcc bug 83143 Giulio Benetti
  2021-08-27 22:34 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
@ 2021-08-27 22:34 ` Giulio Benetti
  1 sibling, 0 replies; 13+ messages in thread
From: Giulio Benetti @ 2021-08-27 22:34 UTC (permalink / raw)
  To: buildroot
  Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Thomas De Schampheleire

The ruby package exhibits gcc bug 83143 when built for the SH4 architecture
with optimization enabled, which causes a build failure.

Differentely from other packages in Buildroot where we work around this
gcc bug by setting optimization to -O0 we can use -freorder-blocks-algorithm=simple
as suggested here [1] if BR2_TOOLCHAIN_HAS_GCC_BUG_83143=y.

Fixes:
http://autobuild.buildroot.net/results/f57/f5742e7fb6e8142bcdb53b7f4f5e9c1bea3558cd/

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

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 package/ruby/ruby.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/package/ruby/ruby.mk b/package/ruby/ruby.mk
index 2434ce946b..b02744f0e5 100644
--- a/package/ruby/ruby.mk
+++ b/package/ruby/ruby.mk
@@ -77,6 +77,14 @@ else
 RUBY_CONF_OPTS += --without-gmp
 endif
 
+RUBY_CFLAGS = $(TARGET_CFLAGS)
+
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_83143),y)
+RUBY_CFLAGS += -freorder-blocks-algorithm=simple
+endif
+
+RUBY_CONF_OPTS += CFLAGS="$(RUBY_CFLAGS)"
+
 # Remove rubygems and friends, as they need extensions that aren't
 # built and a target compiler.
 RUBY_EXTENSIONS_REMOVE = rake* rdoc* rubygems*
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
  2021-08-27 22:34 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
@ 2021-08-28 12:06   ` Arnout Vandecappelle
  2021-08-28 12:39     ` Giulio Benetti
  0 siblings, 1 reply; 13+ messages in thread
From: Arnout Vandecappelle @ 2021-08-28 12:06 UTC (permalink / raw)
  To: Giulio Benetti, buildroot
  Cc: Romain Naour, Thomas De Schampheleire, Thomas Petazzoni



On 28/08/2021 00:34, Giulio Benetti wrote:
> ruby package fails to build for the SH4 architecture with optimization
> enabled with gcc = 9.3.0:
> http://autobuild.buildroot.net/results/f57/f5742e7fb6e8142bcdb53b7f4f5e9c1bea3558cd/
> 
> It's already been reported upstream:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
>  toolchain/Config.in | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/toolchain/Config.in b/toolchain/Config.in
> index bf2bb3efe4..4419443930 100644
> --- a/toolchain/Config.in
> +++ b/toolchain/Config.in
> @@ -133,6 +133,15 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
>  	bool
>  	default y if BR2_microblaze
>  
> +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
> +# Error: invalid operands (*UND* and .text sections) for `-' on sh4.
> +# This bug no longer exists in gcc 10.x but reappeared on gcc 11.x and
> +# it still not been fixed yet.
> +config BR2_TOOLCHAIN_HAS_GCC_BUG_83143
> +	bool
> +	default y if !BR2_TOOLCHAIN_GCC_AT_LEAST_10

 The condition doesn't correspond to the comment above...


 Regards,
 Arnout

> +	depends on BR2_sh4
> +
>  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85180. This bug no
>  # longer exists in gcc 8.x.
>  config BR2_TOOLCHAIN_HAS_GCC_BUG_85180
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
  2021-08-28 12:06   ` Arnout Vandecappelle
@ 2021-08-28 12:39     ` Giulio Benetti
  2021-08-29 15:23       ` Arnout Vandecappelle
  0 siblings, 1 reply; 13+ messages in thread
From: Giulio Benetti @ 2021-08-28 12:39 UTC (permalink / raw)
  To: Arnout Vandecappelle
  Cc: Romain Naour, Thomas De Schampheleire, Thomas Petazzoni, buildroot

Hi Arnout,

> Il giorno 28 ago 2021, alle ore 14:06, Arnout Vandecappelle <arnout@mind.be> ha scritto:
> 
> 
> 
>> On 28/08/2021 00:34, Giulio Benetti wrote:
>> ruby package fails to build for the SH4 architecture with optimization
>> enabled with gcc = 9.3.0:
>> http://autobuild.buildroot.net/results/f57/f5742e7fb6e8142bcdb53b7f4f5e9c1bea3558cd/
>> 
>> It's already been reported upstream:
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
>> 
>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> ---
>> toolchain/Config.in | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>> 
>> diff --git a/toolchain/Config.in b/toolchain/Config.in
>> index bf2bb3efe4..4419443930 100644
>> --- a/toolchain/Config.in
>> +++ b/toolchain/Config.in
>> @@ -133,6 +133,15 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
>>    bool
>>    default y if BR2_microblaze
>> 
>> +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
>> +# Error: invalid operands (*UND* and .text sections) for `-' on sh4.
>> +# This bug no longer exists in gcc 10.x but reappeared on gcc 11.x and
>> +# it still not been fixed yet.
>> +config BR2_TOOLCHAIN_HAS_GCC_BUG_83143
>> +    bool
>> +    default y if !BR2_TOOLCHAIN_GCC_AT_LEAST_10
> 
> The condition doesn't correspond to the comment above...

I’ve tried it and checked .config
I find it emitted on gcc 9 and 11 while on gcc 10 not as described.
It’s always difficult to me to understand how that variable works.

Giulio

> 
> 
> Regards,
> Arnout
> 
>> +    depends on BR2_sh4
>> +
>> # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85180. This bug no
>> # longer exists in gcc 8.x.
>> config BR2_TOOLCHAIN_HAS_GCC_BUG_85180
>> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
  2021-08-28 12:39     ` Giulio Benetti
@ 2021-08-29 15:23       ` Arnout Vandecappelle
  2021-08-29 21:49         ` Giulio Benetti
  0 siblings, 1 reply; 13+ messages in thread
From: Arnout Vandecappelle @ 2021-08-29 15:23 UTC (permalink / raw)
  To: Giulio Benetti
  Cc: Romain Naour, Thomas De Schampheleire, Thomas Petazzoni, buildroot



On 28/08/2021 14:39, Giulio Benetti wrote:
> Hi Arnout,
> 
>> Il giorno 28 ago 2021, alle ore 14:06, Arnout Vandecappelle <arnout@mind.be> ha scritto:
>>
>> 
>>
>>> On 28/08/2021 00:34, Giulio Benetti wrote:
>>> ruby package fails to build for the SH4 architecture with optimization
>>> enabled with gcc = 9.3.0:
>>> http://autobuild.buildroot.net/results/f57/f5742e7fb6e8142bcdb53b7f4f5e9c1bea3558cd/
>>>
>>> It's already been reported upstream:
>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
>>>
>>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>>> ---
>>> toolchain/Config.in | 9 +++++++++
>>> 1 file changed, 9 insertions(+)
>>>
>>> diff --git a/toolchain/Config.in b/toolchain/Config.in
>>> index bf2bb3efe4..4419443930 100644
>>> --- a/toolchain/Config.in
>>> +++ b/toolchain/Config.in
>>> @@ -133,6 +133,15 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
>>>    bool
>>>    default y if BR2_microblaze
>>>
>>> +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
>>> +# Error: invalid operands (*UND* and .text sections) for `-' on sh4.
>>> +# This bug no longer exists in gcc 10.x but reappeared on gcc 11.x and
>>> +# it still not been fixed yet.
>>> +config BR2_TOOLCHAIN_HAS_GCC_BUG_83143
>>> +    bool
>>> +    default y if !BR2_TOOLCHAIN_GCC_AT_LEAST_10
>>
>> The condition doesn't correspond to the comment above...
> 
> I’ve tried it and checked .config
> I find it emitted on gcc 9 and 11 while on gcc 10 not as described.

 I don't know what you did differently, but that's not what I have...

With this defconfig:

BR2_sh=y
BR2_GCC_VERSION_11_X=y

grep GCC_BUG_83143 .config

produces no output, while with this defconfig:

BR2_sh=y
BR2_GCC_VERSION_9_X=y

it does show it.


 BTW, I didn't notice before, but: why is this only for sh4, and not any other
SuperH? I mean, are you sure it's only on sh4? sh4 is the only one tested in the
autobuilders, of course, but it's kind of likely that other SuperH suffer from
the same bug...


> It’s always difficult to me to understand how that variable works.

 It's very simple: AT_LEAST_10_X is true for all GCC >= 10.0, so also for GCC
11. If you want exactly one version, it's AT_LEAST_10 && !AT_LEAST_11. In this
case, you want the negative of that, so !AT_LEAST_10 || AT_LEAST_11.

 Regards,
 Arnout

> 
> Giulio
> 
>>
>>
>> Regards,
>> Arnout
>>
>>> +    depends on BR2_sh4
>>> +
>>> # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85180. This bug no
>>> # longer exists in gcc 8.x.
>>> config BR2_TOOLCHAIN_HAS_GCC_BUG_85180
>>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
  2021-08-29 15:23       ` Arnout Vandecappelle
@ 2021-08-29 21:49         ` Giulio Benetti
  2021-08-30 21:59           ` Thomas Petazzoni
  0 siblings, 1 reply; 13+ messages in thread
From: Giulio Benetti @ 2021-08-29 21:49 UTC (permalink / raw)
  To: Arnout Vandecappelle
  Cc: Romain Naour, Thomas Petazzoni, Thomas De Schampheleire, buildroot

Hi Arnout,

On 8/29/21 5:23 PM, Arnout Vandecappelle wrote:
> 
> 
> On 28/08/2021 14:39, Giulio Benetti wrote:
>> Hi Arnout,
>>
>>> Il giorno 28 ago 2021, alle ore 14:06, Arnout Vandecappelle <arnout@mind.be> ha scritto:
>>>
>>> 
>>>
>>>> On 28/08/2021 00:34, Giulio Benetti wrote:
>>>> ruby package fails to build for the SH4 architecture with optimization
>>>> enabled with gcc = 9.3.0:
>>>> http://autobuild.buildroot.net/results/f57/f5742e7fb6e8142bcdb53b7f4f5e9c1bea3558cd/
>>>>
>>>> It's already been reported upstream:
>>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
>>>>
>>>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>>>> ---
>>>> toolchain/Config.in | 9 +++++++++
>>>> 1 file changed, 9 insertions(+)
>>>>
>>>> diff --git a/toolchain/Config.in b/toolchain/Config.in
>>>> index bf2bb3efe4..4419443930 100644
>>>> --- a/toolchain/Config.in
>>>> +++ b/toolchain/Config.in
>>>> @@ -133,6 +133,15 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
>>>>     bool
>>>>     default y if BR2_microblaze
>>>>
>>>> +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
>>>> +# Error: invalid operands (*UND* and .text sections) for `-' on sh4.
>>>> +# This bug no longer exists in gcc 10.x but reappeared on gcc 11.x and
>>>> +# it still not been fixed yet.
>>>> +config BR2_TOOLCHAIN_HAS_GCC_BUG_83143
>>>> +    bool
>>>> +    default y if !BR2_TOOLCHAIN_GCC_AT_LEAST_10
>>>
>>> The condition doesn't correspond to the comment above...
>>
>> I’ve tried it and checked .config
>> I find it emitted on gcc 9 and 11 while on gcc 10 not as described.
> 
>   I don't know what you did differently, but that's not what I have...
> 
> With this defconfig:
> 
> BR2_sh=y
> BR2_GCC_VERSION_11_X=y
> 
> grep GCC_BUG_83143 .config
> 
> produces no output, while with this defconfig:
> 
> BR2_sh=y
> BR2_GCC_VERSION_9_X=y
> 
> it does show it.

My bad, I've only issued 'make menuconfig' and saved after adding the 
bug and some mess came out. So now doing make a _defconfig from scratch 
gives me your same result.

> 
>   BTW, I didn't notice before, but: why is this only for sh4, and not any other
> SuperH? I mean, are you sure it's only on sh4? sh4 is the only one tested in the
> autobuilders, of course, but it's kind of likely that other SuperH suffer from
> the same bug...

This makes a lot of sense, indeed I'm trying to build for sh2a with Big 
Endian for example and I've found a bug while trying to build 
gcc9/10-final for it:
xgcc: error: SH2a does not support little-endian
I need to find the reason, since:
BR2_ENDIAN="BIG"
probably a bug in gcc? Need to find.

I try with another sh arch then I try to build ruby and check if the 
error is the same, that is very likely to happen and then I could 
transform BR2_sh4 to BR2_sh. And same goes for other sh4 bugs already 
present. But need to re-test them.

> 
>> It’s always difficult to me to understand how that variable works.
> 
>   It's very simple: AT_LEAST_10_X is true for all GCC >= 10.0, so also for GCC
> 11. If you want exactly one version, it's AT_LEAST_10 && !AT_LEAST_11. In this
> case, you want the negative of that, so !AT_LEAST_10 || AT_LEAST_11.

Ok, thank you. Indeed at the moment it only emits that bug with gcc 9 
only. Instead with !AT_LEAST_10 || AT_LEAST_11 it works as described.

Thank you for explaining!

Best regards
-- 
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
  2021-08-29 21:49         ` Giulio Benetti
@ 2021-08-30 21:59           ` Thomas Petazzoni
  2021-08-31 17:37             ` [Buildroot] [PATCH v2 0/2] Add and workaround gcc bug 83143 Giulio Benetti
  2021-08-31 17:43             ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
  0 siblings, 2 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2021-08-30 21:59 UTC (permalink / raw)
  To: Giulio Benetti; +Cc: Romain Naour, Thomas De Schampheleire, buildroot

Hello Giulio,

On Sun, 29 Aug 2021 23:49:57 +0200
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:

> I try with another sh arch then I try to build ruby and check if the 
> error is the same, that is very likely to happen and then I could 
> transform BR2_sh4 to BR2_sh. And same goes for other sh4 bugs already 
> present. But need to re-test them.

To be honest, I wouldn't bother testing all possible SuperH
architecture variants. If one issue affects SH4, just assume it affects
all SuperH variants, and be done with it. SuperH is basically dead, and
the only products using SuperH are under maintenance mode so I don't
think we should put too much effort in determining specifically which
variant of SuperH is affected by each specific gcc bug.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v2 0/2] Add and workaround gcc bug 83143
  2021-08-30 21:59           ` Thomas Petazzoni
@ 2021-08-31 17:37             ` Giulio Benetti
  2021-08-31 17:37               ` [Buildroot] [PATCH v2 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
                                 ` (2 more replies)
  2021-08-31 17:43             ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
  1 sibling, 3 replies; 13+ messages in thread
From: Giulio Benetti @ 2021-08-31 17:37 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Petazzoni, Giulio Benetti, Romain Naour, Thomas De Schampheleire

This patchset add gcc bug 83143 and work it around for package ruby with
a more specific CFLAG instead of the classic -O0. The work around has been
suggested here[1] and saves lot of memory since here ruby is the package
affected by this bug and it's pretty big.

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

V1->V2:
* fixed bug gcc version condition
* introduce this bug for BR2_sh and not only for BR2_sh4

Giulio Benetti (2):
  toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
  package/ruby: fix build failure due to gcc bug 83143

 package/ruby/ruby.mk | 8 ++++++++
 toolchain/Config.in  | 9 +++++++++
 2 files changed, 17 insertions(+)

-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v2 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
  2021-08-31 17:37             ` [Buildroot] [PATCH v2 0/2] Add and workaround gcc bug 83143 Giulio Benetti
@ 2021-08-31 17:37               ` Giulio Benetti
  2021-08-31 17:38               ` [Buildroot] [PATCH v2 2/2] package/ruby: fix build failure due to gcc bug 83143 Giulio Benetti
  2021-09-11 16:20               ` [Buildroot] [PATCH v2 0/2] Add and workaround " Arnout Vandecappelle
  2 siblings, 0 replies; 13+ messages in thread
From: Giulio Benetti @ 2021-08-31 17:37 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Petazzoni, Giulio Benetti, Romain Naour, Thomas De Schampheleire

ruby package fails to build for the SH4 architecture with optimization
enabled with gcc = 9.3.0:
http://autobuild.buildroot.net/results/f57/f5742e7fb6e8142bcdb53b7f4f5e9c1bea3558cd/

It's already been reported upstream:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143

Anyway let's assume all SuperH(BR2_sh) have this bug according to:
http://lists.busybox.net/pipermail/buildroot/2021-August/621906.html

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
V1->V2:
* fixed bug gcc version condition
* introduce this bug for BR2_sh and not only for BR2_sh4
---
 toolchain/Config.in | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/toolchain/Config.in b/toolchain/Config.in
index bf2bb3efe4..d6381f64a0 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -133,6 +133,15 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_68485
 	bool
 	default y if BR2_microblaze
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
+# Error: invalid operands (*UND* and .text sections) for `-' on sh4.
+# This bug no longer exists in gcc 10.x but reappeared on gcc 11.x and
+# it still not been fixed yet.
+config BR2_TOOLCHAIN_HAS_GCC_BUG_83143
+	bool
+	default y if BR2_sh
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_10 || BR2_TOOLCHAIN_GCC_AT_LEAST_11
+
 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85180. This bug no
 # longer exists in gcc 8.x.
 config BR2_TOOLCHAIN_HAS_GCC_BUG_85180
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v2 2/2] package/ruby: fix build failure due to gcc bug 83143
  2021-08-31 17:37             ` [Buildroot] [PATCH v2 0/2] Add and workaround gcc bug 83143 Giulio Benetti
  2021-08-31 17:37               ` [Buildroot] [PATCH v2 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
@ 2021-08-31 17:38               ` Giulio Benetti
  2021-09-11 16:20               ` [Buildroot] [PATCH v2 0/2] Add and workaround " Arnout Vandecappelle
  2 siblings, 0 replies; 13+ messages in thread
From: Giulio Benetti @ 2021-08-31 17:38 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Petazzoni, Giulio Benetti, Romain Naour, Thomas De Schampheleire

The ruby package exhibits gcc bug 83143 when built for the SH4 architecture
with optimization enabled, which causes a build failure.

Differentely from other packages in Buildroot where we work around this
gcc bug by setting optimization to -O0 we can use -freorder-blocks-algorithm=simple
as suggested here [1] if BR2_TOOLCHAIN_HAS_GCC_BUG_83143=y.

Fixes:
http://autobuild.buildroot.net/results/f57/f5742e7fb6e8142bcdb53b7f4f5e9c1bea3558cd/

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

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 package/ruby/ruby.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/package/ruby/ruby.mk b/package/ruby/ruby.mk
index 2434ce946b..b02744f0e5 100644
--- a/package/ruby/ruby.mk
+++ b/package/ruby/ruby.mk
@@ -77,6 +77,14 @@ else
 RUBY_CONF_OPTS += --without-gmp
 endif
 
+RUBY_CFLAGS = $(TARGET_CFLAGS)
+
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_83143),y)
+RUBY_CFLAGS += -freorder-blocks-algorithm=simple
+endif
+
+RUBY_CONF_OPTS += CFLAGS="$(RUBY_CFLAGS)"
+
 # Remove rubygems and friends, as they need extensions that aren't
 # built and a target compiler.
 RUBY_EXTENSIONS_REMOVE = rake* rdoc* rubygems*
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
  2021-08-30 21:59           ` Thomas Petazzoni
  2021-08-31 17:37             ` [Buildroot] [PATCH v2 0/2] Add and workaround gcc bug 83143 Giulio Benetti
@ 2021-08-31 17:43             ` Giulio Benetti
  1 sibling, 0 replies; 13+ messages in thread
From: Giulio Benetti @ 2021-08-31 17:43 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Romain Naour, Thomas De Schampheleire, buildroot

Hi Thomas, Arnout, All,

On 8/30/21 11:59 PM, Thomas Petazzoni wrote:
> Hello Giulio,
> 
> On Sun, 29 Aug 2021 23:49:57 +0200
> Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> 
>> I try with another sh arch then I try to build ruby and check if the
>> error is the same, that is very likely to happen and then I could
>> transform BR2_sh4 to BR2_sh. And same goes for other sh4 bugs already
>> present. But need to re-test them.
> 
> To be honest, I wouldn't bother testing all possible SuperH
> architecture variants. If one issue affects SH4, just assume it affects
> all SuperH variants, and be done with it. SuperH is basically dead, and
> the only products using SuperH are under maintenance mode so I don't
> think we should put too much effort in determining specifically which
> variant of SuperH is affected by each specific gcc bug.

Fine, I've just sent the v2 series with BR2_sh.

Since the already committed bugs are not listed in order(101952 is 
before 101915/101916), I would send a patch for re-ordering them and 
another to substitute BR_sh4 with BR_sh(bug 101952 and 101916 has 
BR_sh4), so we have a standard form for SuperH, is it fine for you?

Best regards
-- 
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Buildroot] [PATCH v2 0/2] Add and workaround gcc bug 83143
  2021-08-31 17:37             ` [Buildroot] [PATCH v2 0/2] Add and workaround gcc bug 83143 Giulio Benetti
  2021-08-31 17:37               ` [Buildroot] [PATCH v2 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
  2021-08-31 17:38               ` [Buildroot] [PATCH v2 2/2] package/ruby: fix build failure due to gcc bug 83143 Giulio Benetti
@ 2021-09-11 16:20               ` Arnout Vandecappelle
  2 siblings, 0 replies; 13+ messages in thread
From: Arnout Vandecappelle @ 2021-09-11 16:20 UTC (permalink / raw)
  To: Giulio Benetti, buildroot
  Cc: Romain Naour, Thomas De Schampheleire, Thomas Petazzoni



On 31/08/2021 19:37, Giulio Benetti wrote:
> This patchset add gcc bug 83143 and work it around for package ruby with
> a more specific CFLAG instead of the classic -O0. The work around has been
> suggested here[1] and saves lot of memory since here ruby is the package
> affected by this bug and it's pretty big.
> 
> [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143#c15
> 
> V1->V2:
> * fixed bug gcc version condition
> * introduce this bug for BR2_sh and not only for BR2_sh4
> 
> Giulio Benetti (2):
>   toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143
>   package/ruby: fix build failure due to gcc bug 83143


 Both applied to master, thanks.

 Regards,
 Arnout

> 
>  package/ruby/ruby.mk | 8 ++++++++
>  toolchain/Config.in  | 9 +++++++++
>  2 files changed, 17 insertions(+)
> 
_______________________________________________
buildroot mailing list
buildroot@lists.buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-09-11 16:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 22:34 [Buildroot] [PATCH 0/2] Add and workaround gcc bug 83143 Giulio Benetti
2021-08-27 22:34 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
2021-08-28 12:06   ` Arnout Vandecappelle
2021-08-28 12:39     ` Giulio Benetti
2021-08-29 15:23       ` Arnout Vandecappelle
2021-08-29 21:49         ` Giulio Benetti
2021-08-30 21:59           ` Thomas Petazzoni
2021-08-31 17:37             ` [Buildroot] [PATCH v2 0/2] Add and workaround gcc bug 83143 Giulio Benetti
2021-08-31 17:37               ` [Buildroot] [PATCH v2 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
2021-08-31 17:38               ` [Buildroot] [PATCH v2 2/2] package/ruby: fix build failure due to gcc bug 83143 Giulio Benetti
2021-09-11 16:20               ` [Buildroot] [PATCH v2 0/2] Add and workaround " Arnout Vandecappelle
2021-08-31 17:43             ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143 Giulio Benetti
2021-08-27 22:34 ` [Buildroot] [PATCH 2/2] package/ruby: fix build failure due to gcc bug 83143 Giulio Benetti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.