Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] package/binutils: Disable -Os for ARM cortex-M cpus
@ 2016-09-04 14:14 Romain Naour
  2016-09-05 19:48 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Romain Naour @ 2016-09-04 14:14 UTC (permalink / raw)
  To: buildroot

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
2 bad relocscollect2: error: ld returned 1 exit status

Binutils build fine with -O1, -O2 or -O3.

Reported upstream:
https://sourceware.org/bugzilla/show_bug.cgi?id=20552

Fixes:
http://autobuild.buildroot.net/results/e72/e727e6e9cf361acc786acec192a88f5f5444a2f6

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
v2: fix condition (ThomasP)
    report the issue upstream (ThomasP)
    use O2 instead of O1 (Baruch)
---
 package/binutils/binutils.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/binutils/binutils.mk b/package/binutils/binutils.mk
index ff90a16..97daeff 100644
--- a/package/binutils/binutils.mk
+++ b/package/binutils/binutils.mk
@@ -77,6 +77,13 @@ ifeq ($(BR2_bfin),y)
 BINUTILS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -O1"
 endif
 
+# Workaround a build issue with -Os for ARM Cortex-M cpus.
+# (Binutils 2.25.1 and 2.26.1)
+# https://sourceware.org/bugzilla/show_bug.cgi?id=20552
+ifeq ($(BR2_ARM_CPU_ARMV7M)$(BR2_OPTIMIZE_S),yy)
+BINUTILS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -O2"
+endif
+
 # Install binutils after busybox to prefer full-blown utilities
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 BINUTILS_DEPENDENCIES += busybox
-- 
2.5.5

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

end of thread, other threads:[~2016-09-05 19:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-04 14:14 [Buildroot] [PATCH v2] package/binutils: Disable -Os for ARM cortex-M cpus Romain Naour
2016-09-05 19:48 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox