[LLVMdev] [cfe-dev] [RFC] When can libc++ "officially" support linux?

David Chisnall David.Chisnall at cl.cam.ac.uk
Sat Feb 21 01:35:52 PST 2015


On 21 Feb 2015, at 03:29, Chandler Carruth <chandlerc at google.com> wrote:
> 
> Eric pointed out to me that this doesn't actually require building libc++ "on top of" libstdc++. libc++abi and libsupc++ are supposed to be ABI-compatible. It should be possible to use libc++, libc++abi, and libstdc++ (without libsupc++). 

Kind of.  If you link both in and different libraries see the common symbols from both then you are going to see some very odd things happen when you throw exceptions - the EH code in both refers to static variables and will become very confused.

The default configuration for libstdc++ statically links libsupc++.  This was the first thing that we had to change on FreeBSD to allow using both libraries, as our libstdc++ lacked some symbols from libcxxrt that libc++ needed.  If you need to work with a vendor-provided libstdc++, then you will probably need to make libc++ use its libsupc++ implementation.

We now support linking both libc++ and libstdc++ into the same binary, but only with libcxxrt (libc++abi would also work, as long as you're willing to give up EH interop with other languages and break anything else that relies on type_info vtable layout).   

David





More information about the llvm-dev mailing list