site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Jun 23, 2005, at 10:11 AM, Andrew Gallatin wrote: I'm trying to compile a unix command-line program on Darwin 8.0 x86, and I'm hitting this problem: The code in it is complaining about is an inline cmpxchgl asm routine: This seems to happen with both gcc-4.0 and gcc-3.3 Can somebody tell me what I'm doing wrong, please? Try putting a / after the lock. Assembler quirk. Also, there are compare-and-swap routines already in libSystem: <libkern/OSAtomic.h> matt. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... /var/tmp/cczbJSUe.s:1993:Can't relocate expression. Absolute 0 assumed. /var/tmp/cczbJSUe.s:1993:operands given don't match any known 386 instruction static inline uint32_t my__cmpswap_u32(uint32_t *ptr, uint32_t old, uint32_t new) { asm volatile("lock cmpxchgl %1,%2" : "=a" (old) : "q" (new), "m" (*ptr),"0" (old) : "memory"); return old; } /* Compare and swap. They return true if the swap occured. */ bool OSAtomicCompareAndSwap32( int32_t oldValue, int32_t newValue, int32_t *theValue ); bool OSAtomicCompareAndSwap32Barrier( int32_t oldValue, int32_t newValue, int32_t *theValue ); This email sent to site_archiver@lists.apple.com