Friendly ping. Is there anything I can help with? In the meantime, I have been able to get some code to run, utilising this on a Cortex M4 in a bare-metal environment. To get it to work I have to patch LLVM 9 clang and libc++ in a few other places anyway, so there is no immediate need to get this upstreamed from my side - but I'd definitely would love to see LLVM as a viable alternative to GCC for such tasks at some point.
Aug 19 2019
Jul 28 2019
My reasoning is the following: If _LIBCPP_ATOMIC_ONLY_USE_BUILTINS were only implied by _LIBCPP_FREESTANDING but not by _LIBCPP_HAS_NO_THREADS, the following paradoxical situation would appear for platforms without threads:
- libc++ *with* -ffreestanding would be a conforming freestanding implementation, but not a conforming hosted implementation (no threads)
- libc++ *without* -ffreestanding would still not be a conforming hosted implementation, but now it wouldn't even be a conforming freestanding implementation (because atomics are now missing).
Thus, the flag -ffreestanding, whose purpose is to *lower* the conformance level actually leads to a *higher* conformance level than without! The standard requires atomics in all conforming cases, whereas it would allow to disable threads under -ffreestanding (but it doesn't require it).