Generated assembly doesn't correspond to the ARM processor

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

Bug Description

While investigating why I couldn't compile sage on the toshiba AC100 (an ARM-based netbook) -- this is report http://trac.sagemath.org/sage_trac/ticket/10285 , 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):

gcc -DPACKAGE_NAME=\"gc\" -DPACKAGE_TARNAME=\"gc\" -DPACKAGE_VERSION=\"7.1\" "-DPACKAGE_STRING=\"gc 7.1\"" -DPACKAGE_BUGREPORT=\"snipped\" -DGC_VERSI
ON_MAJOR=7 -DGC_VERSION_MINOR=1 -DPACKAGE=\"gc\" -DVERSION=\"7.1\" -DGC_LINUX_TH
READS=1 -D_REENTRANT=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE
_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DNO_EXECUTE_
PERMISSION=1 -DALL_INTERIOR_POINTERS=1 -DGC_GCJ_SUPPORT=1 -DJAVA_FINALIZATION=1
-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
gcc-4.4_4.4.4-14ubuntu5_armel.deb

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:
 http://trac.sagemath.org/sage_trac/ticket/10285

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
#endif

#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
#endif

#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
#endif

#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
#endif

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.