[PATCH] D35780: Introduce -nostdlib++ flag to disable linking the C++ standard library.
Joerg Sonnenberger via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 23 13:51:00 PDT 2017
On Sun, Jul 23, 2017 at 03:17:32PM -0400, Nico Weber via cfe-commits wrote:
> On Sun, Jul 23, 2017 at 3:08 PM, Joerg Sonnenberger via Phabricator via
> cfe-commits <cfe-commits at lists.llvm.org> wrote:
>
> > joerg added a comment.
> >
> > I don't really like this.
>
> That's cool, you don't need to use the flag.
I'm not talking about the flag, but the implementation.
> > The reason why -lm is added explicitly on many targets is because the C++
> > STL typically depends on it and that means for static linking and broken
> > ELF linkers, it will be necessary to link against it explicitly.
> >
>
> The driver adds -lm at the end, so it'll work if you add your static libc++
> flag in user flags, and then -lm gets added at the end. But from what I
> understand, -lm is also there as a usability thing to make c++ a bit more
> accessible than c in this regard, not just for the c++ standard library.
> (Also, if you're trying to statically link your c++ lib, it's possible you
> have some influence on your linker as well.)
I don't think so, it strongly seems to be an implementation detail of
the STL interaction.
> > There is also the question on whether any platform we have currently uses
> > separate STL and ABI libraries and it is not clear whether the flag should
> > handle both.
> >
>
> Yes, it should handle both.
If you update the comments and documentation accordingly and stop the
current passing of -lm, it is fine with me. I don't think the libmath
handling should be forced on other STL implementations.
More information about the cfe-commits
mailing list