[Buildroot] [PATCH] package/binutils: Disable -Os for Thumb-2 only platforms

Romain Naour romain.naour at smile.fr
Sun Sep 4 09:18:19 UTC 2016


Hi Baruch,

Le 04/09/2016 à 10:55, Baruch Siach a écrit :
> Hi Romain,
> 
> On Sun, Sep 04, 2016 at 10:49:50AM +0200, Romain Naour wrote:
>> 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.
> 
> Is there an upstream bug report we can refer to?

No, I can't find any bug report.
Also I don't understand the meaning of this error, I just try some other build
options and figured out that the issue was caused by -Os.

> 
>> Fixes:
>> http://autobuild.buildroot.net/results/e72/e727e6e9cf361acc786acec192a88f5f5444a2f6
>>
>> Signed-off-by: Romain Naour <romain.naour at gmail.com>
>> Cc: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
>> ---
>>  package/binutils/binutils.mk | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/package/binutils/binutils.mk b/package/binutils/binutils.mk
>> index ff90a16..6946e7e 100644
>> --- a/package/binutils/binutils.mk
>> +++ b/package/binutils/binutils.mk
>> @@ -77,6 +77,12 @@ ifeq ($(BR2_bfin),y)
>>  BINUTILS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -O1"
>>  endif
>>  
>> +# Workaround a build issue with -Os on Thumb-2 only platforms
>> +# (such as Cortex-M). (Binutils 2.25.1 and 2.26.1)
>> +ifeq ($(BR2_ARM_CPU_HAS_ARM)$(BR2_OPTIMIZE_S),yy)
>> +BINUTILS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -O1"
> 
> Isn't -O2 the more "standard" optimization option?

Yes maybe, it's just because I borrowed the same line above for Blackfin :)
As I said on the commit log, Binutils build fine with O1,O2 and O3 so use O2 if
it's more "standard" optimization option.

Thanks!

Best regards,
Romain

> 
>> +endif
> 
> baruch
> 




More information about the buildroot mailing list