buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] Introduce and work-around Gcc Bug 101737
@ 2021-08-03  8:42 Giulio Benetti
  2021-08-03  8:42 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_101737 Giulio Benetti
  2021-08-03  8:42 ` [Buildroot] [PATCH 2/2] package/pixman: fix build failure due to gcc bug 101737 Giulio Benetti
  0 siblings, 2 replies; 8+ messages in thread
From: Giulio Benetti @ 2021-08-03  8:42 UTC (permalink / raw)
  To: buildroot
  Cc: Bernd Kuhls, Giulio Benetti, Romain Naour,
	Thomas De Schampheleire, Thomas Petazzoni

This patchset introduce and work-around Gcc Bug 101737 opened by Thomas
Petazzoni:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101737

Bug shows up while building package pixman and it's worked around disabling
optimization by passing -O0 to CFLAGS.

Giulio Benetti (2):
  toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_101737
  package/pixman: fix build failure due to gcc bug 101737

 package/pixman/pixman.mk | 10 +++++++++-
 toolchain/Config.in      |  7 +++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

-- 
2.25.1

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

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

* [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_101737
  2021-08-03  8:42 [Buildroot] [PATCH 0/2] Introduce and work-around Gcc Bug 101737 Giulio Benetti
@ 2021-08-03  8:42 ` Giulio Benetti
  2021-08-08 19:04   ` Peter Korsgaard
  2021-08-03  8:42 ` [Buildroot] [PATCH 2/2] package/pixman: fix build failure due to gcc bug 101737 Giulio Benetti
  1 sibling, 1 reply; 8+ messages in thread
From: Giulio Benetti @ 2021-08-03  8:42 UTC (permalink / raw)
  To: buildroot
  Cc: Bernd Kuhls, Giulio Benetti, Romain Naour,
	Thomas De Schampheleire, Thomas Petazzoni

pixman package fails to build for the SH4 architecture with optimization
enabled with gcc up to 11.1.0:
http://autobuild.buildroot.net/results/b20/b20869bbb48edb1f0a847ea9e2e1a0462d6350be/

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

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

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 3598307b20..3888eeafe2 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -170,6 +170,13 @@ config BR2_TOOLCHAIN_HAS_GCC_BUG_99140
 	bool
 	default y if BR2_nios2 && !BR2_TOOLCHAIN_GCC_AT_LEAST_9
 
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101737
+# ICE: SH4 -Os causes internal compiler error. This bug
+# still exists in gcc = 11.1.0
+config BR2_TOOLCHAIN_HAS_GCC_BUG_101737
+	bool
+	default y if BR2_sh4
+
 config BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	bool
 
-- 
2.25.1

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

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

* [Buildroot] [PATCH 2/2] package/pixman: fix build failure due to gcc bug 101737
  2021-08-03  8:42 [Buildroot] [PATCH 0/2] Introduce and work-around Gcc Bug 101737 Giulio Benetti
  2021-08-03  8:42 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_101737 Giulio Benetti
@ 2021-08-03  8:42 ` Giulio Benetti
  2021-08-04 20:28   ` Arnout Vandecappelle
  2021-08-08 19:04   ` Peter Korsgaard
  1 sibling, 2 replies; 8+ messages in thread
From: Giulio Benetti @ 2021-08-03  8:42 UTC (permalink / raw)
  To: buildroot
  Cc: Bernd Kuhls, Giulio Benetti, Romain Naour,
	Thomas De Schampheleire, Thomas Petazzoni

The pixman package exhibits gcc bug 101737 when built for the SH4
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_GCC_BUG_101737=y.
Also let's add PIXMAN_CFLAGS and pass the Codesourcery work around CFLAGS
to it for consistency like we do for the rest of the packages.

Fixes:
http://autobuild.buildroot.net/results/b20/b20869bbb48edb1f0a847ea9e2e1a0462d6350be/

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

diff --git a/package/pixman/pixman.mk b/package/pixman/pixman.mk
index d99005ecb7..6fab539593 100644
--- a/package/pixman/pixman.mk
+++ b/package/pixman/pixman.mk
@@ -44,12 +44,20 @@ ifneq ($(BR2_iwmmxt),y)
 PIXMAN_CONF_OPTS += --disable-arm-iwmmxt
 endif
 
+PIXMAN_CFLAGS = $(TARGET_CFLAGS)
+
 # toolchain gets confused about TLS access through GOT (PIC), so disable TLS
 # movhi	r4, %got_hiadj(%tls_ldo(fast_path_cache))
 # {standard input}:172: Error: bad expression
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII),y)
-PIXMAN_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -DPIXMAN_NO_TLS"
+PIXMAN_CFLAGS += -DPIXMAN_NO_TLS
+endif
+
+ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_101737),y)
+PIXMAN_CFLAGS += -O0
 endif
 
+PIXMAN_CONF_OPTS += CFLAGS="$(PIXMAN_CFLAGS)"
+
 $(eval $(autotools-package))
 $(eval $(host-autotools-package))
-- 
2.25.1

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

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

* Re: [Buildroot] [PATCH 2/2] package/pixman: fix build failure due to gcc bug 101737
  2021-08-03  8:42 ` [Buildroot] [PATCH 2/2] package/pixman: fix build failure due to gcc bug 101737 Giulio Benetti
@ 2021-08-04 20:28   ` Arnout Vandecappelle
  2021-08-05  6:58     ` Giulio Benetti
  2021-08-08 19:04   ` Peter Korsgaard
  1 sibling, 1 reply; 8+ messages in thread
From: Arnout Vandecappelle @ 2021-08-04 20:28 UTC (permalink / raw)
  To: Giulio Benetti, buildroot
  Cc: Bernd Kuhls, Romain Naour, Thomas Petazzoni, Thomas De Schampheleire

 Hi Giulio,

On 03/08/2021 10:42, Giulio Benetti wrote:
> The pixman package exhibits gcc bug 101737 when built for the SH4
> 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_GCC_BUG_101737=y.
> Also let's add PIXMAN_CFLAGS and pass the Codesourcery work around CFLAGS
> to it for consistency like we do for the rest of the packages.
> 
> Fixes:
> http://autobuild.buildroot.net/results/b20/b20869bbb48edb1f0a847ea9e2e1a0462d6350be/
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
>  package/pixman/pixman.mk | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/package/pixman/pixman.mk b/package/pixman/pixman.mk
> index d99005ecb7..6fab539593 100644
> --- a/package/pixman/pixman.mk
> +++ b/package/pixman/pixman.mk
> @@ -44,12 +44,20 @@ ifneq ($(BR2_iwmmxt),y)
>  PIXMAN_CONF_OPTS += --disable-arm-iwmmxt
>  endif
>  
> +PIXMAN_CFLAGS = $(TARGET_CFLAGS)
> +
>  # toolchain gets confused about TLS access through GOT (PIC), so disable TLS
>  # movhi	r4, %got_hiadj(%tls_ldo(fast_path_cache))
>  # {standard input}:172: Error: bad expression
>  ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII),y)
> -PIXMAN_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -DPIXMAN_NO_TLS"
> +PIXMAN_CFLAGS += -DPIXMAN_NO_TLS
> +endif
> +
> +ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_101737),y)

 I believe Thomas's experiments showed that it only occurs under -Os. So I think
we should do this conditionally under BR2_OPTIMIZE_S, and use -O2 rather than -O0.


 Regards,
 Arnout

> +PIXMAN_CFLAGS += -O0
>  endif
>  
> +PIXMAN_CONF_OPTS += CFLAGS="$(PIXMAN_CFLAGS)"
> +
>  $(eval $(autotools-package))
>  $(eval $(host-autotools-package))
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/2] package/pixman: fix build failure due to gcc bug 101737
  2021-08-04 20:28   ` Arnout Vandecappelle
@ 2021-08-05  6:58     ` Giulio Benetti
  2021-08-05 19:31       ` Arnout Vandecappelle
  0 siblings, 1 reply; 8+ messages in thread
From: Giulio Benetti @ 2021-08-05  6:58 UTC (permalink / raw)
  To: Arnout Vandecappelle
  Cc: Bernd Kuhls, Romain Naour, Thomas Petazzoni,
	Thomas De Schampheleire, buildroot

Hi Arnout, Thomas,

> Il giorno 4 ago 2021, alle ore 22:28, Arnout Vandecappelle <arnout@mind.be> ha scritto:
> 
>  Hi Giulio,
> 
>> On 03/08/2021 10:42, Giulio Benetti wrote:
>> The pixman package exhibits gcc bug 101737 when built for the SH4
>> 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_GCC_BUG_101737=y.
>> Also let's add PIXMAN_CFLAGS and pass the Codesourcery work around CFLAGS
>> to it for consistency like we do for the rest of the packages.
>> 
>> Fixes:
>> http://autobuild.buildroot.net/results/b20/b20869bbb48edb1f0a847ea9e2e1a0462d6350be/
>> 
>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> ---
>> package/pixman/pixman.mk | 10 +++++++++-
>> 1 file changed, 9 insertions(+), 1 deletion(-)
>> 
>> diff --git a/package/pixman/pixman.mk b/package/pixman/pixman.mk
>> index d99005ecb7..6fab539593 100644
>> --- a/package/pixman/pixman.mk
>> +++ b/package/pixman/pixman.mk
>> @@ -44,12 +44,20 @@ ifneq ($(BR2_iwmmxt),y)
>> PIXMAN_CONF_OPTS += --disable-arm-iwmmxt
>> endif
>> 
>> +PIXMAN_CFLAGS = $(TARGET_CFLAGS)
>> +
>> # toolchain gets confused about TLS access through GOT (PIC), so disable TLS
>> # movhi    r4, %got_hiadj(%tls_ldo(fast_path_cache))
>> # {standard input}:172: Error: bad expression
>> ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII),y)
>> -PIXMAN_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -DPIXMAN_NO_TLS"
>> +PIXMAN_CFLAGS += -DPIXMAN_NO_TLS
>> +endif
>> +
>> +ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_101737),y)
> 
> I believe Thomas's experiments showed that it only occurs under -Os. So I think
> we should do this conditionally under BR2_OPTIMIZE_S, and use -O2 rather than -O0.

Yes, you’re right, but at a certain point, if I remember correctly, we’ve decided to uniform this kind work-arounds using -O0,
 indeed some other gcc bug could be solved differently but we kept -O0 way to have a “standard” solution.

What do you think about it?

Otherwise I do as you’ve described above, no problem.

Best regards
Giulio Benetti

> 
> 
> Regards,
> Arnout
> 
>> +PIXMAN_CFLAGS += -O0
>> endif
>> 
>> +PIXMAN_CONF_OPTS += CFLAGS="$(PIXMAN_CFLAGS)"
>> +
>> $(eval $(autotools-package))
>> $(eval $(host-autotools-package))
>> 

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

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

* Re: [Buildroot] [PATCH 2/2] package/pixman: fix build failure due to gcc bug 101737
  2021-08-05  6:58     ` Giulio Benetti
@ 2021-08-05 19:31       ` Arnout Vandecappelle
  0 siblings, 0 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2021-08-05 19:31 UTC (permalink / raw)
  To: Giulio Benetti
  Cc: Bernd Kuhls, Romain Naour, Thomas Petazzoni,
	Thomas De Schampheleire, buildroot



On 05/08/2021 08:58, Giulio Benetti wrote:
> Hi Arnout, Thomas,
> 
>> Il giorno 4 ago 2021, alle ore 22:28, Arnout Vandecappelle <arnout@mind.be> ha scritto:
>>
>>  Hi Giulio,
>>
>>> On 03/08/2021 10:42, Giulio Benetti wrote:
>>> The pixman package exhibits gcc bug 101737 when built for the SH4
>>> 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_GCC_BUG_101737=y.
>>> Also let's add PIXMAN_CFLAGS and pass the Codesourcery work around CFLAGS
>>> to it for consistency like we do for the rest of the packages.
>>>
>>> Fixes:
>>> http://autobuild.buildroot.net/results/b20/b20869bbb48edb1f0a847ea9e2e1a0462d6350be/
>>>
>>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>>> ---
>>> package/pixman/pixman.mk | 10 +++++++++-
>>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/package/pixman/pixman.mk b/package/pixman/pixman.mk
>>> index d99005ecb7..6fab539593 100644
>>> --- a/package/pixman/pixman.mk
>>> +++ b/package/pixman/pixman.mk
>>> @@ -44,12 +44,20 @@ ifneq ($(BR2_iwmmxt),y)
>>> PIXMAN_CONF_OPTS += --disable-arm-iwmmxt
>>> endif
>>>
>>> +PIXMAN_CFLAGS = $(TARGET_CFLAGS)
>>> +
>>> # toolchain gets confused about TLS access through GOT (PIC), so disable TLS
>>> # movhi    r4, %got_hiadj(%tls_ldo(fast_path_cache))
>>> # {standard input}:172: Error: bad expression
>>> ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII),y)
>>> -PIXMAN_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -DPIXMAN_NO_TLS"
>>> +PIXMAN_CFLAGS += -DPIXMAN_NO_TLS
>>> +endif
>>> +
>>> +ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_101737),y)
>>
>> I believe Thomas's experiments showed that it only occurs under -Os. So I think
>> we should do this conditionally under BR2_OPTIMIZE_S, and use -O2 rather than -O0.
> 
> Yes, you’re right, but at a certain point, if I remember correctly, we’ve decided to uniform this kind work-arounds using -O0,
>  indeed some other gcc bug could be solved differently but we kept -O0 way to have a “standard” solution.

 Fair enough. Both applied to master, thanks.

 Regards,
 Arnout

> 
> What do you think about it?
> 
> Otherwise I do as you’ve described above, no problem.
> 
> Best regards
> Giulio Benetti
> 
>>
>>
>> Regards,
>> Arnout
>>
>>> +PIXMAN_CFLAGS += -O0
>>> endif
>>>
>>> +PIXMAN_CONF_OPTS += CFLAGS="$(PIXMAN_CFLAGS)"
>>> +
>>> $(eval $(autotools-package))
>>> $(eval $(host-autotools-package))
>>>
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_101737
  2021-08-03  8:42 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_101737 Giulio Benetti
@ 2021-08-08 19:04   ` Peter Korsgaard
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Korsgaard @ 2021-08-08 19:04 UTC (permalink / raw)
  To: Giulio Benetti
  Cc: Bernd Kuhls, Romain Naour, Thomas Petazzoni,
	Thomas De Schampheleire, buildroot

>>>>> "Giulio" == Giulio Benetti <giulio.benetti@benettiengineering.com> writes:

 > pixman package fails to build for the SH4 architecture with optimization
 > enabled with gcc up to 11.1.0:
 > http://autobuild.buildroot.net/results/b20/b20869bbb48edb1f0a847ea9e2e1a0462d6350be/

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

 > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>

Committed to 2021.02.x and 2021.05.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/2] package/pixman: fix build failure due to gcc bug 101737
  2021-08-03  8:42 ` [Buildroot] [PATCH 2/2] package/pixman: fix build failure due to gcc bug 101737 Giulio Benetti
  2021-08-04 20:28   ` Arnout Vandecappelle
@ 2021-08-08 19:04   ` Peter Korsgaard
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Korsgaard @ 2021-08-08 19:04 UTC (permalink / raw)
  To: Giulio Benetti
  Cc: Bernd Kuhls, Romain Naour, Thomas Petazzoni,
	Thomas De Schampheleire, buildroot

>>>>> "Giulio" == Giulio Benetti <giulio.benetti@benettiengineering.com> writes:

 > The pixman package exhibits gcc bug 101737 when built for the SH4
 > 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_GCC_BUG_101737=y.
 > Also let's add PIXMAN_CFLAGS and pass the Codesourcery work around CFLAGS
 > to it for consistency like we do for the rest of the packages.

 > Fixes:
 > http://autobuild.buildroot.net/results/b20/b20869bbb48edb1f0a847ea9e2e1a0462d6350be/

 > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>

Committed to 2021.02.x and 2021.05.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

end of thread, other threads:[~2021-08-08 19:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03  8:42 [Buildroot] [PATCH 0/2] Introduce and work-around Gcc Bug 101737 Giulio Benetti
2021-08-03  8:42 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_GCC_BUG_101737 Giulio Benetti
2021-08-08 19:04   ` Peter Korsgaard
2021-08-03  8:42 ` [Buildroot] [PATCH 2/2] package/pixman: fix build failure due to gcc bug 101737 Giulio Benetti
2021-08-04 20:28   ` Arnout Vandecappelle
2021-08-05  6:58     ` Giulio Benetti
2021-08-05 19:31       ` Arnout Vandecappelle
2021-08-08 19:04   ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).