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

Sebastian Huber sebastian.huber@embedded-brains.de
Tue May 28 11:03:00 GMT 2013

On 05/28/2013 11:36 AM, Richard Earnshaw wrote:
> On 27/05/13 07:59, Sebastian Huber wrote:
>> On 05/27/2013 04:18 AM, Bin.Cheng wrote:
>> [...]
>>> Though I have no right to approve the patch, I would like to have below
>>> comment.
>>> UAL is generally preferred, thus you may handle armv6-m specially by
>>> keeping UAL for it. For example,
>>> #if (defined(__thumb__) && defined(__ARM_ARCH_6M__))
>>> //...
>>> #endif
>> Which problem does this additional pre-processor complexity solve?  The
>> generated machine code is the same.
> I don't think either patch is correct.  Instead we should explicitly mark the
> attributes in this case, probably as follows, but I've only smoke tested this.
> Sebastian, does this fix your problem?

This patches fixes my problem.  I get now this:

readelf -A ./arm-rtems4.11/thumb/newlib/libc/machine/arm/lib_a-strcmp.o
Attribute Section: aeabi
File Attributes
   Tag_CPU_name: "4T"
   Tag_CPU_arch: v4T
   Tag_THUMB_ISA_use: Thumb-1
   Tag_also_compatible_with: v6-M

The application link process yields now an ARMv4T executable.  Without the 
patch I had "blx" instructions in the executable which are not supported on 
ARM7TDMI-S processors.

Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

More information about the Newlib mailing list