[PATCH] D33638: [libcxx] Have separate abi library flags for static and shared builds

Martell Malone via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 28 15:28:50 PDT 2017


martell created this revision.
Herald added a subscriber: mgorny.

While we can enable both `LIBCXX_ENABLE_SHARED` and `LIBCXX_ENABLE_STATIC` because we only build one set of objects this inadvertently ends up messing up the flags of one of the two builds.
This is because `_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS` should be set for a static build but not for a shared build.

Also on that note static and shared builds need to be able to decide which type of abi library to link to independently so
I have introduced `LIBCXX_ENABLE_STATIC_ABI_LIBRARY_FOR_STATIC` and `LIBCXX_ENABLE_STATIC_ABI_LIBRARY_FOR_SHARED`
(better naming suggestions are also welcome)

The default is currently off for both but I would like to suggest we set `LIBCXX_ENABLE_STATIC_ABI_LIBRARY_FOR_STATIC` to ON by default.
I believe static builds by default should try to use a static libc++abi and combine them into one library.
Shared builds should remain using a shared libc++abi as the default.

This gives the power at the cmake level to override this and link shared with static and static with shared if desired.

I also cleaned up some small nits also.
llvm-ar exports COFF objects as `.obj` so the python script to combine the libs should allow not just `.o`
compiler-rt is added to the default libs in config-ix.cmake so we should not manually add `-rtlib=compiler-rt` to the link flags


Repository:
  rL LLVM

https://reviews.llvm.org/D33638

Files:
  CMakeLists.txt
  lib/CMakeLists.txt
  utils/merge_archives.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33638.100570.patch
Type: text/x-patch
Size: 9533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170528/b7f3dc48/attachment.bin>


More information about the llvm-commits mailing list