[Mono-dev] Mono and ARM Thumb

Cliff Brake cliff.brake at gmail.com
Wed Jan 7 09:42:33 EST 2009


I ran into an interesting build error this morning that might be worth
documenting ...

When building mono with the latest toolchains built with OpenEmbedded, I get:

/tmp/ccYsXwlg.s:3067: Error: selected processor does not support `swp
r2,r0,[r4]'
/tmp/ccYsXwlg.s:3161: Error: selected processor does not support `swp
r2,r0,[r4]'
/tmp/ccYsXwlg.s:3272: Error: selected processor does not support `swp
r3,r4,[r5]'

In the libgc code, there is the following:

#    ifdef ARM32
       inline static int GC_test_and_set(volatile unsigned int *addr) {
         int oldval;
         /* SWP on ARM is very similar to XCHG on x86.  Doesn't lock the
          * bus because there are no SMP ARM machines.  If/when there are,
          * this code will likely need to be updated. */
         /* See linuxthreads/sysdeps/arm/pt-machine.h in glibc-2.1 */
         __asm__ __volatile__("swp %0, %1, [%2]"
                            : "=&r"(oldval)
                            : "r"(1), "r"(addr)
                            : "memory");
         return oldval;
       }

The OE ARMv5te and ARMv4 have recently switched to thumb as the
default compilation mode as I think there is general consensus that
thumb binaries are faster than arm binaries (plus smaller).

The solution was to set ARM_INSTRUCTION_SET = "arm" in the Mono OE recipes.

http://git.openembedded.net/?p=openembedded.git;a=commitdiff;h=f6876205bcd8ad0c86d93a32d426d2deb31c875c;hp=d45651ebb1a1ac66b850a35f16b2a58d14b56ec2

So the until the above code is updated, it should be noted that we
can't compile Mono for ARM thumb mode.

I also noticed in the above comments the assumption that there are no
SMP ARM machines -- this is changing as there are now SMP ARM
machines.

Thanks,
Cliff

-- 
=======================
Cliff Brake
http://bec-systems.com


More information about the Mono-devel-list mailing list