[PATCH] D23719: [libc++] Use C11 for atomics check
Shoaib Meenai via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 19 16:44:53 PDT 2016
smeenai added a comment.
In https://reviews.llvm.org/D23719#521250, @rsmith wrote:
> Is there a -nodefaultlib analogue of -nostdinc++ to turn off just the C++ standard library portion of the link?
There's `-nostdlib`, but if I'm parsing the GCC documentation <https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html> correctly, it's even more restrictive than `-nodefaultlibs`, since it omits the startup files as well.
> My concern is that -nodefaultlib may suppress the addition of -latomic to the link line, and if so, the configure-time check would always fail, even though an actual link using libc++'s <atomic> would work.
Hmm. I understand what you mean, but this configure-time check is for compiling libc++ itself, and if a driver adds `-latomic` automatically, I'd argue this check is actually incorrect as it stands right now:
- We run `check_cxx_source_compiles` to check if `-latomic` is required
- This links without `-nodefaultlibs`, and the driver adds the `-latomic` in that case, so we report that we don't need the flag
- We try compiling libc+, which passes `-nodefaultlibs`, and now the driver doesn't give us `-latomic`, and our configuration said we didn't need the flag explicitly, so compilation fails
If the driver doesn't add `-latomic` automatically, the above wouldn't be a problem, but then my proposed change wouldn't be a problem either.
https://reviews.llvm.org/D23719
More information about the cfe-commits
mailing list