This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: libgo patch committed: Add __sync_bool_compare_and_swap_4
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Tue, 1 Feb 2011 20:50:29 +0000 (UTC)
- Subject: Re: libgo patch committed: Add __sync_bool_compare_and_swap_4
- References: <mcrd3nbldes.fsf@google.com>
On Tue, 1 Feb 2011, Ian Lance Taylor wrote:
> The libgo library uses __sync_bool_compare_and_swap_4 (i.e., uses
> __sync_bool_compare_and_swap on uint32 types). That function is not
> available for all gcc targets. This patch adds the function to the
> library for those cases. Ideally this would be handled by libgcc, but
> that does not currently happen. This function should be harmless if
> libgcc does get an implementation.
On some targets libgcc does have an implementation (ARM, PA, SH Linux -
note that for more recent ARM architectures the sync operations are
inlined). The __HAVE_* macros only know about whether the operation can
be inlined, not about whether it's available in libgcc. libstdc++-v3 uses
link tests to see if these operations are available (either inlined or in
libgcc - or for that matter in libc, which could make sense for kernel
helpers accessed through a vDSO).
For more general questions about implementing atomics in libgcc, see past
discussions around implementing C++0x/C1x atomics.
--
Joseph S. Myers
joseph@codesourcery.com