This is an archive of the discontinued LLVM Phabricator instance.

[libcxxabi] Support building hermetic static library
ClosedPublic

Authored by phosek on Dec 21 2018, 2:31 PM.

Details

Summary

This is useful when the static libc++abi library is being linked into
shared libraries that may be used in with other shared libraries that
use different C++ library. We want to avoid avoid exporting libc++abi
or libc++ symbols in those cases. This achieved by a new CMake option
which can be enabled by libc++abi vendors as needed.

Diff Detail

Repository
rL LLVM

Event Timeline

phosek created this revision.Dec 21 2018, 2:31 PM

This is a libc++abi counterpart of D55404. We combine both libc++abi and libc++ into a single static archive and for it to be hermetic, we need to make sure that both libc++abi and libc++ were built as such.

ldionne added inline comments.Jan 7 2019, 9:10 AM
libcxxabi/src/CMakeLists.txt
185 ↗(On Diff #179359)

Does it make any sense to have LIBCXXABI_HERMETIC_STATIC_LIBRARY and LIBCXXABI_ENABLE_SHARED at the same time? I don't understand why we're creating a target named cxxabi_shared when LIBCXXABI_HERMETIC_STATIC_LIBRARY is true.

phosek updated this revision to Diff 181482.Jan 13 2019, 1:44 PM
phosek marked 2 inline comments as done.
phosek added inline comments.Jan 13 2019, 7:00 PM
libcxxabi/src/CMakeLists.txt
185 ↗(On Diff #179359)

When not building hermetic static library, we share objects between static and shared library, but when building the hermetic static library we cannot do that because those objects are build with different flags, hence this check. I've modified the code to follow the same pattern I used in libc++ build which hopefully makes it less confusing.

ldionne accepted this revision.Jan 22 2019, 7:17 AM
This revision is now accepted and ready to land.Jan 22 2019, 7:17 AM
This revision was automatically updated to reflect the committed changes.