Hello, I try to write a lock-free program where compare-and-swap is needed. I checked the online document of gcc (http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Atomic-Builtins.html) and found gcc provides a builtin function called __sync_bool_compare_and_swap, which does exactly as I want. When I used it in my program, gcc complains that it cannot find the symbol. Here is my test program. int main(int argc, char *argv[]) { long a = 1; long b = 2; printf ("cmp switch: %d\n", __sync_val_compare_and_swap (&a, 1, b)); } da-zhengs-macbook:tmp dazheng$ gcc -o test test.c Undefined symbols: "___sync_val_compare_and_swap_4", referenced from: _main in ccyxRK5Y.o ld: symbol(s) not found collect2: ld returned 1 exit status I use macbook and it has Intel Dual core. My GCC version is 4.4.1. Could anyone tell me why __sync_val_compare_and_swap cannot be used. Thank you. Zheng Da