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

Rafael EspĂ­ndola via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 18 15:20:40 PST 2015


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. Do you know why -stdlib=libc++ is not a clang++ only option?

Cheers,
Rafael


More information about the cfe-commits mailing list