[Buildroot] [git commit branch/2021.08.x] package/ruby: fix build failure due to gcc bug 83143

Peter Korsgaard peter at korsgaard.com
Mon Sep 13 17:25:09 UTC 2021


commit: https://git.buildroot.net/buildroot/commit/?id=a0f807a4bb1d123a86ac71d873b5c8e942c6db08
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2021.08.x

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 at benettiengineering.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
(cherry picked from commit 4e070082495c1686b2b207db7fe7720271dc7d86)
Signed-off-by: Peter Korsgaard <peter at korsgaard.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*


More information about the buildroot mailing list