[Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_83143

Giulio Benetti giulio.benetti at benettiengineering.com
Sun Aug 29 21:49:57 UTC 2021


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 at 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 at 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


More information about the buildroot mailing list