[PATCH] D15598: [Driver] Make AddCXXStdlibLibArgs responsible for handling -static-libstdc++.

Alexey Samsonov via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 18 15:41:11 PST 2015


On Fri, Dec 18, 2015 at 3:20 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> On 18 December 2015 at 18:13, Alexey Samsonov <vonosmas at gmail.com> wrote:
> > samsonov added a comment.
> >
> > In http://reviews.llvm.org/D15598#314127, @rafael wrote:
> >
> >> I am not sure what is "expected" is here:
> >
> >
> > Interesting.
> > I was assuming that Clang tends to understand "-lstdc++" as a special
> argument that says "link against C++ standard library", not "link against
> libstdc++.{a,so}".
> > For instance,
> >
> >   clang a.cc -lstdc++ -stdlib=libc++
> >
> > will effectively replace "-lstdc++" with "-lc++", and
> >
> >   clang++ a.cc -stdlib=libc++ -static-libstdc++
> >
> > will link against libc++ statically. In that sense, it makes sense to
> assume that "-static-libstdc++" will bind to "-lstdc++" argument.
> >
> > Apparently, it's not what GCC does :( Do you think we should keep being
> compatible here?
>
> My preference would be for -lstdc++ to be as least special as
> possible.


Got it. I can always use "-Bstatic -lstdc++ -Bdynamic" to manually link
against my explicitly passed libstdc++,
I just wanted to make it less ugly.


> Do you know why -stdlib=libc++ is not a clang++ only option?
>

Not really. However, I believe there are setups which only use "clang" (w/o
even --driver-mode=g++) and
pass include/library directories manually, and -stdlib=libc++ might be
handy to choose between standard lib version.


> Cheers,
> Rafael
>


-- 
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151218/5fbf968b/attachment-0001.html>


More information about the cfe-commits mailing list