In some places in libc++ we need to use the __atomic_* builtins. This patch adds a header that provides access to those builtins in a uniform way from within the dylib source.
If the compiler building the dylib does not support these builtins then a warning is issued.
Only relaxed loads are needed within the headers. A singe function to do these relaxed loads has been added to <memory>.
This patch applies the new atomic builtins to __shared_count and call_once.
Can you please leave a note that says that these relaxed stores pair with the relaxed load in the header? The atomic nature of the stores look superfluous because they are performed under the mutex.