Detect at compile-time if sync primitives are supported?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have got some code that calls
__sync_fetch_and_add
__sync_synchronize
__sync_lock_test_and_set

and it's OK for some target cpus (eg arm cortex-m4), but fails to link
when compiled for arm cortex-m0 for lack of the corresponding
functions
__sync_lock_test_and_set_4
__sync_fetch_and_add_4
__sync_lock_test_and_set_1

I plan to implement those for such cpus (possibly with reduced
functionality) as an helper library, but I'd like to do so only when
needed.

Is checking for __GCC_HAVE_SYNC_COMPARE_AND_SWAP_X the right way of
knowing whether I need to provide a definition for
__sync_lock_test_and_set_X for instance?

Thanks,

Christophe



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux