[libcxx-commits] [PATCH] D60049: [libc++abi] Add LIBCXXABI_ENABLE_PIC cmake option

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 2 15:42:33 PDT 2019


ldionne added a comment.

In D60049#1450593 <https://reviews.llvm.org/D60049#1450593>, @sbc100 wrote:

> My understanding is that POSITION_INDEPENDENT_CODE should always be on when building shared libraries.  What would it mean to build a non-PIC shared library?
>
> The motivation for this change is allow me to disable PIC code in non-shared libraries.   For WebAssembly we currently disable shared libraries so increasing the reach of this option wouldn't break us, but I'm not sure I see any reason to do that.


For example, Apple's `libc++.dylib` is not built with `-fPIC`. I believe this is because of the shared linker cache but I should investigate TBH. But regardless, it does make sense not to force shared libraries to be built with `-fPIC` if the user doesn't want that.

However, there's a twist here. We're using an object library to create the shared library so the CMake default for enabling `-fPIC` (on for shared libraries, off for static libraries) is not going to trigger, and the shared library will never be built with `-fPIC`. We need a bit of refactoring for this to be possible.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60049





More information about the libcxx-commits mailing list