Generated assembly doesn't correspond to the ARM processor

Bug #677360 reported by Snark on 2010-11-19
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
gcc-defaults (Ubuntu)

Bug Description

While investigating why I couldn't compile sage on the toshiba AC100 (an ARM-based netbook) -- this is report , it appeared that some of the problems are due to the compiler, which from a C file goes to an assembly file... and then fails to build it!

Here is an example -- taken from Boehm's garbage collector's failed compilation (the full build log is attached to the sage report):

-DATOMIC_UNCOLLECTABLE=1 -DLARGE_CONFIG=1 -I./include -fexceptions -I libatomic_
ops/src -g -O2 -MT alloc.lo -MD -MP -MF .deps/alloc.Tpo -c alloc.c -fPIC -DPIC
-o .libs/alloc.o
/tmp/cckXY2Jn.s: Assembler messages:
/tmp/cckXY2Jn.s:1314: Error: selected processor does not support Thumb mode `swp ip,r2,[r3]'
/tmp/cckXY2Jn.s:1371: Error: selected processor does not support Thumb mode `swp ip,r0,[r2]'
/tmp/cckXY2Jn.s:2783: Error: selected processor does not support Thumb mode `swp lr,r2,[r6]'
/tmp/cckXY2Jn.s:2851: Error: selected processor does not support Thumb mode `swp r1,r0,[r3]'
/tmp/cckXY2Jn.s:3613: Error: selected processor does not support Thumb mode `swp ip,r2,[r3]'
/tmp/cckXY2Jn.s:3652: Error: selected processor does not support Thumb mode `swp ip,r1,[r3]'
make[3]: *** [alloc.lo] Error 1

Snark (julien-puydt) wrote :

Notice that launchpad insisted that my package number doesn't exist -- but I know it does, since the head of /usr/share/doc/gcc-4.4/changelog.Debian.gz is :
gcc-4.4 (4.4.4-14ubuntu5) maverick; urgency=low

  * Avoid include paths starting with a double slash. LP: #635840.

 -- Matthias Klose <email address hidden> Mon, 27 Sep 2010 16:00:29 +0200

and :
$ ls /var/cache/apt/archives/ | grep gcc-4.4

I say it is 4.4.4-14ubuntu5, and I have good reasons to think so!

tsg1zzn (tsg1zzn) on 2010-11-19
affects: ubuntu → gcc-defaults (Ubuntu)
tags: added: arm
Dimitri John Ledkov (xnox) wrote :

can linaro-gcc toolchain build this?

Michael Hope (michaelh1) wrote :

Hi there. I think the original author has a configuration problem. The code above is in sysdeps/gcc/arm.h and has two chunks: one with a #ifdef __ARMv6__ around it which uses the correct Thumb-2 instructions, and the fallback version for earlier architectures that uses the (no longer supported) 'swp' instruction. For some reason his setup is picking up the pre-v6 version.

Note that the same code in the libatomic-ops-dev compiles correctly under Ubuntu Maverick. I don't think this is a compiler problem.

I've posted more detail on the original bug at:

Changed in gcc-linaro:
status: New → Invalid
Matthias Klose (doko) wrote :

The thing is that there's a plethora of defines, and even GCC itself doesn't get it right all the times.

see libffi/src/arm/sysv.S. This is error prone, and maybe Linaro should push something better upstream.

/* We need a better way of testing for this, but for now, this is all
   we can do. */
@ This selects the minimum architecture level required.
#define __ARM_ARCH__ 3

#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__)
# undef __ARM_ARCH__
# define __ARM_ARCH__ 4

#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
        || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
        || defined(__ARM_ARCH_5TEJ__)
# undef __ARM_ARCH__
# define __ARM_ARCH__ 5

#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
        || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
        || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
        || defined(__ARM_ARCH_6M__)
# undef __ARM_ARCH__
# define __ARM_ARCH__ 6

#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
        || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
        || defined(__ARM_ARCH_7EM__)
# undef __ARM_ARCH__
# define __ARM_ARCH__ 7

tags: added: armel toolchain
Matthias Klose (doko) on 2014-06-11
Changed in gcc-defaults (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.