Skip to contentSkip to conversation

package/binutils: Disable -Os for ARM cortex-M cpus

PATCH New Romain Naour 2 participants 2 messages Sep 4, 2016 – Sep 5, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/binutils: Disable -Os for ARM cortex-M cpus

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

Cc Thomas Petazzoni <[email protected]>

---
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(+)
package/binutils/binutils.mk +7 -0
index ff90a16..97daeff 100644
@@ -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
Signature · 1 line
2.5.5
#1 lore raw

PATCH v2 1/1 package/binutils: Disable -Os for ARM cortex-M cpus

Hello,

Quoted 14 lines · Romain Naour

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

Cc Thomas Petazzoni <[email protected]>
Quoted 7 lines

---
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(+)

Applied to master, thanks. Of course, once we get the feedback from Nicholas Walton, we might re-adjust this fix.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com