[libc++abi] Remove the LIBCXXABI_ENABLE_PIC option

Instead, people should be using CMAKE_POSITION_INDEPENDENT_CODE to control
whether they want to use PIC or not. We should try to avoid reinventing
the wheel whenever CMake natively supports something.

This makes libc++abi consistent with libc++ and libunwind.

Differential Revision: https://reviews.llvm.org/D103973
This commit is contained in:
Louis Dionne 2021-06-09 13:04:32 -04:00
parent c3cc14f87f
commit a0ae3b0789
4 changed files with 4 additions and 10 deletions

View File

@ -15,6 +15,5 @@ set(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS ON CACHE BOOL "")
set(LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "") set(LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "")
set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "") set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "")
set(LIBCXXABI_ENABLE_PIC OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_ASSERTIONS OFF CACHE BOOL "") set(LIBCXXABI_ENABLE_ASSERTIONS OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_FORGIVING_DYNAMIC_CAST ON CACHE BOOL "") set(LIBCXXABI_ENABLE_FORGIVING_DYNAMIC_CAST ON CACHE BOOL "")

View File

@ -65,3 +65,7 @@ API Changes
While this is technically both an API and an ABI break, we do not expect While this is technically both an API and an ABI break, we do not expect
``std::pointer_safety`` to have been used at all in real code, since we ``std::pointer_safety`` to have been used at all in real code, since we
never implemented the underlying support for garbage collection. never implemented the underlying support for garbage collection.
- The `LIBCXXABI_ENABLE_PIC` CMake option was removed. If you are building your
own libc++abi from source and were using `LIBCXXABI_ENABLE_PIC`, please use
`CMAKE_POSITION_INDEPENDENT_CODE=ON` instead.

View File

@ -82,7 +82,6 @@ option(LIBCXXABI_ENABLE_EXCEPTIONS
When disabled, libc++abi does not support stack unwinding and other exceptions-related features." ON) When disabled, libc++abi does not support stack unwinding and other exceptions-related features." ON)
option(LIBCXXABI_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON) option(LIBCXXABI_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." ON) 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) option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF) option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." OFF) option(LIBCXXABI_ENABLE_STATIC_UNWINDER "Statically link the LLVM unwinder." OFF)

View File

@ -201,10 +201,6 @@ if (LIBCXXABI_ENABLE_SHARED)
DEFINE_SYMBOL DEFINE_SYMBOL
"") "")
if(LIBCXXABI_ENABLE_PIC)
set_target_properties(cxxabi_shared PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_shared") list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_shared")
if (LIBCXXABI_INSTALL_SHARED_LIBRARY) if (LIBCXXABI_INSTALL_SHARED_LIBRARY)
list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared") list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared")
@ -262,10 +258,6 @@ if (LIBCXXABI_ENABLE_STATIC)
OUTPUT_NAME OUTPUT_NAME
"c++abi") "c++abi")
if(LIBCXXABI_ENABLE_PIC)
set_target_properties(cxxabi_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
if(LIBCXXABI_HERMETIC_STATIC_LIBRARY) if(LIBCXXABI_HERMETIC_STATIC_LIBRARY)
append_flags_if_supported(CXXABI_STATIC_LIBRARY_FLAGS -fvisibility=hidden) append_flags_if_supported(CXXABI_STATIC_LIBRARY_FLAGS -fvisibility=hidden)
# If the hermetic library doesn't define the operator new/delete functions # If the hermetic library doesn't define the operator new/delete functions