[libcxx-commits] [PATCH] D60173: [libc++abi] Do not share an object library to create the static/shared libraries

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 3 10:54:22 PDT 2019


phosek added inline comments.


================
Comment at: libcxxabi/CMakeLists.txt:49
 option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
-option(LIBCXXABI_ENABLE_PIC "Build Position-Independent Code, even in static library" ON)
 option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
----------------
ldionne wrote:
> phosek wrote:
> > ldionne wrote:
> > > Why are we dropping this?
> > AFAICT CMake automatically includes `-fPIC` for both shared and static library (I checked the generated `build.ninja` files) so this shouldn't be needed, or do you want to have an explicit option to disable `-fPIC`? If so, should there be a similar option for libunwind and libc++ as well?
> I don't think it does for static libraries. From https://cmake.org/cmake/help/v3.14/prop_tgt/POSITION_INDEPENDENT_CODE.html:
> 
> > The `POSITION_INDEPENDENT_CODE` property determines whether position independent executables or shared libraries will be created. This property is `True` by default for `SHARED` and `MODULE` library targets and `False` otherwise. This property is initialized by the value of the `CMAKE_POSITION_INDEPENDENT_CODE` variable if it is set when a target is created.
> 
> I'm personally fine with relying on `CMAKE_POSITION_INDEPENDENT_CODE` to control that, but other folks wanted more control.
It seems like the `-fPIC` I saw in `build.ninja` is added by LLVM, if I do a standalone build of libc++abi, it's not there.


Repository:
  rCXXA libc++abi

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60173/new/

https://reviews.llvm.org/D60173





More information about the libcxx-commits mailing list