2

I am trying to build a C++ program for ARM in an ODROID X2 board by using Linaro 12.11. In the compiling process, I found this type of error, in which I couldn't find the answer:

/tmp/ccsPcPGU.s: Assembler messages:

/tmp/ccsPcPGU.s:5488: Error: selected processor does not support Thumb mode `swp r3,sl,[fp]'

I don't even remember using Thumb mode here. Is there any suggestion how I can solve this problem?

Update:

@auselen This is what I got for gcc -v :

root@linaro-ubuntu-desktop:/# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 --with-mode=thumb --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)

I still got the same problem when I tried to compile each project constructor file by using gcc -c, so I am going to believe that there is a problem with my arm-linux-gnueabihf.

g3rv4
  • 19,750
  • 4
  • 36
  • 58
maxximal
  • 23
  • 2
  • 6
  • 1
    You need to provide more information. Error message from assembler without a context doesn't say too much. How does your `Android.mk` look like? Did you force thumb mode anywhere? Are you trying to link some already build objects? – auselen Sep 05 '13 at 06:08
  • @auselen First of all, I'm not using Android here. I tried to build an example project which previously run on LINUX. I'm quite noob for these things but I have to make this project run in odroid. I only found 'system.mk' in the project and it look like this: – maxximal Sep 05 '13 at 06:44
  • Sorry for confusing it with Android, may be odroid name reminded me that. Still `android-ndk` might attract people. Please update the question, your `system.mk` didn't show up in comments. – auselen Sep 05 '13 at 08:20
  • woopz, I didn't know that. Here is the link to `system.mk` file: [link](https://github.com/maxximal/CauseOfCraziness/blob/master/system.mk) – maxximal Sep 05 '13 at 08:54
  • I'll put my two cents in toolchain issues. `swp` should be obsolete for `ARMv7`. What does `gcc -v` outputs? – auselen Sep 05 '13 at 10:46
  • So the problem is in `--with-mode=thumb` right? Do you know how to change it and into what format? by the way, thanks for the enlightenment.^-^ – maxximal Sep 06 '13 at 02:25
  • Try '-marm' in CFLAGS, also do enable verbose building, so you'll see full compiler invocations. – auselen Sep 06 '13 at 05:49
  • @auselen Thanks a lot, it solves one of my problems. – maxximal Sep 06 '13 at 05:55

2 Answers2

1

The SWP/SWPB instructions do not exist in the Thumb instruction set.

If the Linaro 12.11 toolchain defaults to Thumb, you are probably missing (or have an incorrect) instruction state directive in the assembly code.

Depending on what is causing the error (an inline asm statement included in C, or a .S file that has been preprocessed), all or parts of your project will need to be built as ARM instructions.

unixsmurf
  • 5,852
  • 1
  • 33
  • 40
  • For the record, I'm using arm-linux-gnueabihf toolchain in here and I couldn't find any code refer to Thumb in my project. Still trying to dig deeper into those files in case I made some mistakes. – maxximal Sep 05 '13 at 08:57
0

It seems the culprit is include/refmem/atomic.h and updating the compiler should fix it: https://github.com/cmyth/cmyth/issues/11

EDIT: according to this bug entry, the fix is available in libgc (1:6.8-1.2ubuntu2).

Igor Skochinsky
  • 24,629
  • 2
  • 72
  • 109