This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Purpose of USE_ATOMIC_COMPILER_BUILTINS
- From: Florian Weimer <fweimer at redhat dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 16 Nov 2015 19:11:48 +0100
- Subject: Re: Purpose of USE_ATOMIC_COMPILER_BUILTINS
- Authentication-results: sourceware.org; auth=none
- References: <5649F832 dot 7000001 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1511161758300 dot 30498 at digraph dot polyomino dot org dot uk>
On 11/16/2015 07:02 PM, Joseph Myers wrote:
> On Mon, 16 Nov 2015, Florian Weimer wrote:
>
>> What is the USE_ATOMIC_COMPILER_BUILTINS? Is it still needed now that
>> we require GCC 4.7 or later to compile glibc?
>
> Yes. glibc can't use out-of-line functions from libatomic, since
> libatomic can only be built after glibc. (Out-of-line functions from
> libgcc are OK if it's considered they don't involve performance issues on
> a particular processor. Built-in functions might generate calls to either
> libgcc or libatomic.) The macro says whether it's known for a given
> architecture that the __atomic_* built-in functions are suitable both
> regarding correctness (not generating calls to libatomic functions for the
> glibc use cases) and performance.
Thanks for the explanation, but I can't say I like this situation.
What do I have to do if I want to add atomic sub-and-fetch with
acquire-release semantics? Should I simply use CAS instead?
If this is too much work, would it be easier to compile libatomic before
glibc instead?
Florian