[libcxx-commits] [PATCH] D103973: [libc++abi] Remove the LIBCXXABI_ENABLE_PIC option

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 9 10:06:10 PDT 2021


ldionne created this revision.
ldionne added a reviewer: phosek.
Herald added a subscriber: mgorny.
ldionne requested review of this revision.
Herald added projects: libc++, libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103973

Files:
  libcxx/cmake/caches/Apple.cmake
  libcxx/docs/ReleaseNotes.rst
  libcxxabi/src/CMakeLists.txt


Index: libcxxabi/src/CMakeLists.txt
===================================================================
--- libcxxabi/src/CMakeLists.txt
+++ libcxxabi/src/CMakeLists.txt
@@ -201,10 +201,6 @@
                           DEFINE_SYMBOL
                             "")
 
-  if(LIBCXXABI_ENABLE_PIC)
-    set_target_properties(cxxabi_shared PROPERTIES POSITION_INDEPENDENT_CODE ON)
-  endif()
-
   list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_shared")
   if (LIBCXXABI_INSTALL_SHARED_LIBRARY)
     list(APPEND LIBCXXABI_INSTALL_TARGETS "cxxabi_shared")
@@ -262,10 +258,6 @@
                           OUTPUT_NAME
                             "c++abi")
 
-  if(LIBCXXABI_ENABLE_PIC)
-    set_target_properties(cxxabi_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
-  endif()
-
   if(LIBCXXABI_HERMETIC_STATIC_LIBRARY)
     append_flags_if_supported(CXXABI_STATIC_LIBRARY_FLAGS -fvisibility=hidden)
     # If the hermetic library doesn't define the operator new/delete functions
Index: libcxx/docs/ReleaseNotes.rst
===================================================================
--- libcxx/docs/ReleaseNotes.rst
+++ libcxx/docs/ReleaseNotes.rst
@@ -65,3 +65,7 @@
   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
   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.
Index: libcxx/cmake/caches/Apple.cmake
===================================================================
--- libcxx/cmake/caches/Apple.cmake
+++ libcxx/cmake/caches/Apple.cmake
@@ -15,6 +15,5 @@
 set(LIBCXX_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_FORGIVING_DYNAMIC_CAST ON CACHE BOOL "")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103973.350937.patch
Type: text/x-patch
Size: 2060 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210609/f1319875/attachment.bin>


More information about the libcxx-commits mailing list