diff mbox series

[1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143

Message ID 20210827223432.1961888-2-giulio.benetti@benettiengineering.com
State Superseded, archived
Headers show
Series Add and workaround gcc bug 83143 | expand

Commit Message

Giulio Benetti Aug. 27, 2021, 10:34 p.m. UTC
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(+)

Comments

Arnout Vandecappelle Aug. 28, 2021, 12:06 p.m. UTC | #1
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
>
Giulio Benetti Aug. 28, 2021, 12:39 p.m. UTC | #2
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
Arnout Vandecappelle Aug. 29, 2021, 3:23 p.m. UTC | #3
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
>
Giulio Benetti Aug. 29, 2021, 9:49 p.m. UTC | #4
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
Thomas Petazzoni Aug. 30, 2021, 9:59 p.m. UTC | #5
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
Giulio Benetti Aug. 31, 2021, 5:43 p.m. UTC | #6
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
diff mbox series

Patch

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