All of lore.kernel.org
 help / color / mirror / Atom feed
* mono build error with swp instruction
@ 2009-01-07 14:35 Cliff Brake
  2009-01-07 14:44 ` Koen Kooi
  2009-01-07 16:21 ` Philip Balister
  0 siblings, 2 replies; 3+ messages in thread
From: Cliff Brake @ 2009-01-07 14:35 UTC (permalink / raw)
  To: openembedded-devel

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

When building mono with the latest toolchains built with OE, 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 solution was to set ARM_INSTRUCTION_SET = "arm" in the mono recipe.

Thanks,
Cliff

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mono build error with swp instruction
  2009-01-07 14:35 mono build error with swp instruction Cliff Brake
@ 2009-01-07 14:44 ` Koen Kooi
  2009-01-07 16:21 ` Philip Balister
  1 sibling, 0 replies; 3+ messages in thread
From: Koen Kooi @ 2009-01-07 14:44 UTC (permalink / raw)
  To: openembedded-devel

On 07-01-09 15:35, Cliff Brake wrote:
> I ran into an interesting build error this morning that might be worth
> documenting ...

Already known:

http://cgit.openembedded.net/cgit.cgi?url=openembedded/commit/&id=e9404d66bec8f92a9e05cda5251078460bdc9ed2

>
> When building mono with the latest toolchains built with OE, 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 solution was to set ARM_INSTRUCTION_SET = "arm" in the mono recipe.
>
> Thanks,
> Cliff
>





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mono build error with swp instruction
  2009-01-07 14:35 mono build error with swp instruction Cliff Brake
  2009-01-07 14:44 ` Koen Kooi
@ 2009-01-07 16:21 ` Philip Balister
  1 sibling, 0 replies; 3+ messages in thread
From: Philip Balister @ 2009-01-07 16:21 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]

Cliff Brake wrote:
> I ran into an interesting build error this morning that might be worth
> documenting ...
> 
> When building mono with the latest toolchains built with OE, 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 solution was to set ARM_INSTRUCTION_SET = "arm" in the mono recipe.

On armv6 and higher, you want to use LDREX and STREX instead of SWP. 
This makes your code SMP ready (and a few other benefits I suspect) :)

Philip


> 
> Thanks,
> Cliff
> 

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3303 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-07 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-07 14:35 mono build error with swp instruction Cliff Brake
2009-01-07 14:44 ` Koen Kooi
2009-01-07 16:21 ` Philip Balister

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.