Using __sync_* builtins within libgcc code
Luke Dalessandro
luked@cs.rochester.edu
Wed Jun 11 12:35:00 GMT 2008
Paolo Carlini wrote:
> Luke Dalessandro wrote:
>> I'm making some modifications to exception handling inside of
>> unwind-dw2-fde.c that I'd like to use __sync_bool_compare_and_swap
>> for, unfortunately I can't seem to figure out how to correctly use
>> builtins in the context of libgcc.
>>
>> I've tried a bunch of different things, but I consistently get the error
>>
>> bin/../lib/gcc/i686-pc-linux-gnu/4.3.1/../../../libgcc_s.so:
>> undefined reference to `__sync_bool_compare_and_swap_4'
>>
> Maybe you can usefully exploit the recently added
> __GCC_HAVE_SYNC_COMPARE_AND_SWAP_* macros or add a few more along the
> same way...
Thank you Paolo, this allows me to wrap cas in a function that falls back to a
mutex for targets that don't support builtins.
I was aware of the i386 restriction, but didn't realize that i686-* platforms
still defaulted to i386.
Thanks for everyone's help.
Luke
More information about the Gcc
mailing list