I've got some code that uses the gcc builtin __sync_bool_compare_and_swap, which is mapped to __sync_bool_compare_and_swap_16 at linktime. But when I link this code I get a "undefined reference to `__sync_bool_compare_and_swap_16'" linker-error. What do I have to link ?
[EDIT]: I got it: I've to compile it with -march:x86-64. Interestingly this doesn't lead to intrinsic compilation, i.e. the compiler inserts the atomic operations appropriately; no, the code is just the same with the call to __sync_bool_compare_and_swap_16, but without a linker error. Does anynone understand this ?