[cfe-dev] Better support for statically linking libc++/libc++abi

David Chisnall via cfe-dev cfe-dev at lists.llvm.org
Fri Oct 16 03:53:43 PDT 2015

On 16 Oct 2015, at 05:16, Nico Weber via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 3. It'd be cool if there was some supported way to build libc++abi in a way that makes it not add a dependency on cxa_demangle() from default_terminate_handler() in cxa_default_handlers.cpp. This one call keeps cxa_demangle() alive, and that takes several hundreds kB of code. For apps sensitive to size (e.g. mobile apps), paying this size cost for almost no benefit seems suboptimal. (We're currently adding an empty cxa_demangle() to one of our source files so that the linker picks that over the one in libc++abi, but that's fairly hacky.)

This is why libcxxrt includes a simpler demangler.  We considered importing the one from libc++abi, but decided that the increase in code size was not worth it.

For what it’s worth, I’ve heard from a couple of companies shipping the combination of libcxxrt and libc++ in their Android apps for precisely this reason.


More information about the cfe-dev mailing list