[PATCH] ARM: Fix strcmp() for Thumb-1

Richard Earnshaw rearnsha@arm.com
Tue May 28 09:42:00 GMT 2013


On 28/05/13 10:37, nick clifton wrote:
> Hi Sebastian,
>
>> The GCC multilib for ARMv4T is broken with the current strcmp()
>> implementation.  GCC will pass no architecture flag to AS in case it
>> builds a multilib for -mthumb with no further architecture options.  The
>> default architecture is ARMv4T in GCC.  The usage of ".syntax unified"
>> instructs AS to produce output for the ARMv6T2 architecture.  Thus we
>> have (readelf -A):
>   >
>> File: ./arm-rtems4.11/thumb/newlib/libc/machine/arm/lib_a-strcmp.o
>> Attribute Section: aeabi
>> File Attributes
>>     Tag_CPU_arch: v6T2
>>     Tag_THUMB_ISA_use: Thumb-2
>

No, that can't be correct.  v6T2 shouldn't be needed for the thumb1 
implementation.

See my proposed patch.

Note, there is a bug in GAS in that it doesn't correctly relax Thumb1 
unified syntax code back from Thumb2 unless the attributes are set 
explicitly.  But that's a slightly different problem from the one here.

R.


> This appears to be correct.  It seems however that there is a similar
> problem for the memchr function as well:
>
> % readelf -A arm-rtems4.11/thumb/newlib/libc/machine/arm/lib_a-memchr.o
> Attribute Section: aeabi
> File Attributes
>     Tag_CPU_name: "7-A"
>     Tag_CPU_arch: v7
>     Tag_CPU_arch_profile: Application
>     Tag_ARM_ISA_use: Yes
>     Tag_THUMB_ISA_use: Thumb-2
>
>
>> newlib/ChangeLog
>> 2013-05-26  Sebastian Huber <sebastian.huber@embedded-brains.de>
>>
>> 	libc/machine/arm/strcmp.S: Fix Thumb-1 version.
>
> The patch works, although given the mail from Chenq I think that adding
> a comment would be helpful.  As in:
>
>> +/* Do not use unified syntax for thumb1 multilibs - it results
>   > +   in the assembler marking the object as requiring a thumb2 ISA.  */
>> +#if !(defined (__thumb__) && !defined (__thumb2__))
>>    .syntax         unified
>> +#endif
>
>
> Cheers
>     Nick
>
>
>
>




More information about the Newlib mailing list