[llvm-branch-commits] gn build: Embed libc++abi.a objects into libc++.a. (PR #88463)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 4 14:00:36 PDT 2024


pcc wrote:

Hmm, after actually doing a CMake build it doesn't seem to be the CMake default in fact. It's what you get if you set `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` to true. I think I got the idea that it was the default after inspecting the NDK compiler, which was built with `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` set to true, combined with the fact that `-static-libstdc++ -stdlib=libc++` does not work out of the box unless you set this (several CMake caches set `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` to true, presumably in order to get this working).

Conceptually we want `libc++.a` to be like `libc++.so`, which is a linker script that causes `libc++.so.1` and `libc++abi.so` to be linked. One way to do that would be to make it a linker script as well. But the other way would be to combine `libc++.a` and `libc++abi.a` by default. On the CMake side that's controlled by `LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY` which defaults to `LIBCXX_ENABLE_STATIC_ABI_LIBRARY`. So maybe the right fix here would be to change `LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY` to default to true, and land this patch to make the gn build consistent?

https://github.com/llvm/llvm-project/pull/88463


More information about the llvm-branch-commits mailing list