<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Jul 23, 2017 4:51 PM, "Joerg Sonnenberger" <<a href="mailto:joerg@bec.de">joerg@bec.de</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Sun, Jul 23, 2017 at 03:17:32PM -0400, Nico Weber via cfe-commits wrote:<br>
> On Sun, Jul 23, 2017 at 3:08 PM, Joerg Sonnenberger via Phabricator via<br>
> cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
><br>
> > joerg added a comment.<br>
> ><br>
> > I don't really like this.<br>
><br>
> That's cool, you don't need to use the flag.<br>
<br>
</div>I'm not talking about the flag, but the implementation.<br>
<div class="quoted-text"><br>
> > The reason why -lm is added explicitly on many targets is because the C++<br>
> > STL typically depends on it and that means for static linking and broken<br>
> > ELF linkers, it will be necessary to link against it explicitly.<br>
> ><br>
><br>
> The driver adds -lm at the end, so it'll work if you add your static libc++<br>
> flag in user flags, and then -lm gets added at the end. But from what I<br>
> understand, -lm is also there as a usability thing to make c++ a bit more<br>
> accessible than c in this regard, not just for the c++ standard library.<br>
> (Also, if you're trying to statically link your c++ lib, it's possible you<br>
> have some influence on your linker as well.)<br>
<br>
</div>I don't think so, it strongly seems to be an implementation detail of<br>
the STL interaction.<br>
<div class="quoted-text"><br>
> > There is also the question on whether any platform we have currently uses<br>
> > separate STL and ABI libraries and it is not clear whether the flag should<br>
> > handle both.<br>
> ><br>
><br>
> Yes, it should handle both.<br>
<br>
</div>If you update the comments and documentation accordingly and stop the<br>
current passing of -lm</blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">If you need this behavior for something, that sounds like something a -nodefaultlibs++ could do. -nostdlib++ is really meant to disable the c++ stdlib and nothing else.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">, it is fine with me. I don't think the libmath<br>
handling should be forced on other STL implementations.<br>
</blockquote></div><br></div></div></div>