Use gcc build-in atomic functions, the selfmade versions will not work on powerpc --- include/private/gc_locks.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -88,6 +88,18 @@ /* acquisition and release. We need this for correct operation of the */ /* incremental GC. */ # ifdef __GNUC__ +#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 1 +static inline int GC_test_and_set(volatile unsigned int *addr) +{ +#define GC_TEST_AND_SET_DEFINED + return (int)__sync_lock_test_and_set(addr, 1); +} +static inline void GC_clear(volatile unsigned int *addr) +{ +#define GC_CLEAR_DEFINED + __sync_lock_test_and_set(addr, 0); +} +#else /* ! __GNUC__ 4.1+ */ # if defined(I386) inline static int GC_test_and_set(volatile unsigned int *addr) { int oldval; @@ -288,6 +300,7 @@ return ret; } # endif +# endif /* !__GNUC__ 4.1+ */ # endif /* __GNUC__ */ # if (defined(ALPHA) && !defined(__GNUC__)) # ifndef OSF1