Purpose of USE_ATOMIC_COMPILER_BUILTINS
Florian Weimer
fweimer@redhat.com
Mon Nov 16 18:11:00 GMT 2015
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
More information about the Libc-alpha
mailing list