Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/3] gnuchess: disable -O2 and -O3 for ARM cortex-M cpus
Date: Thu, 10 Jan 2019 18:59:54 +0100	[thread overview]
Message-ID: <20190110175955.31565-2-fontaine.fabrice@gmail.com> (raw)
In-Reply-To: <20190110175955.31565-1-fontaine.fabrice@gmail.com>

When building with -O2 (or -O3), link fails on:

/home/rclinux/rc-buildroot-test/scripts/instance-0/output/host/bin/arm-linux-g++ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -O2 -Wl,-elf2flt -static  -Wl,-elf2flt -static   -Wl,-elf2flt -static -o gnuchess main.o components.o  frontend/libfrontend.a adapter/libadapter.a engine/libengine.a -lreadline -lncurses
ERROR: reloc type R_ARM_THM_MOVW_ABS_NC unsupported in this context
ERROR: reloc type R_ARM_THM_MOVT_ABS unsupported in this context
ERROR: reloc type R_ARM_THM_MOVW_ABS_NC unsupported in this context
ERROR: reloc type R_ARM_THM_MOVT_ABS unsupported in this context
ERROR: reloc type R_ARM_THM_MOVW_ABS_NC unsupported in this context
ERROR: reloc type R_ARM_THM_MOVT_ABS unsupported in this context
ERROR: reloc type R_ARM_THM_MOVW_ABS_NC unsupported in this context

To fix this, replace -O2 or -O3 by -Os

Fixes:
 - http://autobuild.buildroot.org/results/7918757b255ed41609609d2083c2d8904ff3136e

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/gnuchess/gnuchess.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/gnuchess/gnuchess.mk b/package/gnuchess/gnuchess.mk
index 0abdab5ba5..b2fbcff864 100644
--- a/package/gnuchess/gnuchess.mk
+++ b/package/gnuchess/gnuchess.mk
@@ -13,4 +13,11 @@ GNUCHESS_DEPENDENCIES = host-flex flex
 GNUCHESS_DEPENDENCIES += $(if $(BR2_PACKAGE_READLINE),readline) \
 	$(TARGET_NLS_DEPENDENCIES)
 
+# Workaround a build issue with -O2 or -03 for ARM Cortex-M cpus
+ifeq ($(BR2_ARM_CPU_ARMV7M):$(BR2_OPTIMIZE_2)$(BR2_OPTIMIZE_3),y:y)
+GNUCHESS_CONF_ENV += \
+	CFLAGS="$(TARGET_CFLAGS) -Os" \
+	CXXFLAGS="$(TARGET_CXXFLAGS) -Os"
+endif
+
 $(eval $(autotools-package))
-- 
2.14.1

  reply	other threads:[~2019-01-10 17:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10 17:59 [Buildroot] [PATCH 1/3] gnuchess: fix license Fabrice Fontaine
2019-01-10 17:59 ` Fabrice Fontaine [this message]
2019-01-10 19:59   ` [Buildroot] [PATCH 2/3] gnuchess: disable -O2 and -O3 for ARM cortex-M cpus Thomas Petazzoni
2019-01-12 17:53     ` Fabrice Fontaine
2019-01-10 17:59 ` [Buildroot] [PATCH 3/3] gnuchess: bump to version 6.2.5 Fabrice Fontaine
2019-01-12 16:56   ` Thomas Petazzoni
2019-01-10 20:41 ` [Buildroot] [PATCH 1/3] gnuchess: fix license Thomas Petazzoni
2019-01-11 10:48   ` Peter Korsgaard
2019-01-24 15:28   ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190110175955.31565-2-fontaine.fabrice@gmail.com \
    --to=fontaine.fabrice@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox