This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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.


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

2013-05-26  Sebastian Huber <>

	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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]