[cfe-dev] -static-libstdc++ & libc++abi

Michał Górny via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 17 21:03:53 PST 2016


On Thu, 17 Nov 2016 21:00:27 -0700
Eric Fiselier via cfe-dev <cfe-dev at lists.llvm.org> wrote:

> On Thu, Nov 17, 2016 at 5:20 PM, Mike Aizatsky via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
> 
> > Hello!
> >
> > I've recently encountered a bug (https://llvm.org/bugs/show_
> > bug.cgi?id=30919) and I would like an advice on how to approach it.
> >
> > It seems that right now libc++abi is not handled by Tools.cpp. Normal
> > linking works  because:
> >
> > $ cat ~/out/llvm/default/lib/libc++.so
> > INPUT(libc++.so.1 -lc++abi)
> >
> > And if I use -static-libstdc++ then c++abi is not automatically linked in
> > at all.
> >
> > Is there a similar magic for .a files like for .so? Should Tools.cpp know
> > about lc++abi? Are there any alternatives?
> >  
> 
> First, Tools.cpp shouldn't know about libc++abi/libsupc++/libcxxrt or w/e
> C++ ABI library your STL is using.
> 
> There are two alternatives to your problem.  If you want to use a static
> libc++abi you can build libc++ with LIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
> <http://libcxx.llvm.org/docs/BuildingLibcxx.html#cmdoption-arg-LIBCXX_ENABLE_STATIC_ABI_LIBRARY>
> .
> Alternatively you can define libc++.a as a linker script just like
> libc++.so. (Ex INPUT(libc++static.a -lc++abi))

I had adding support for static linker scripts somewhere in my TODO.
However, I'm not sure if I will proceed with it anytime soon since
touching anything linking-related turns out being a huge can of worms,
and Eric ends up having to fix my mistakes ;-).

-- 
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 931 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161118/c53c7963/attachment.sig>


More information about the cfe-dev mailing list