[libcxx-commits] [PATCH] D77370: [libunwind] Add LIBUNWIND_ENABLE_PIC

Raul Tambre via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Apr 4 01:57:48 PDT 2020


tambre updated this revision to Diff 255015.
tambre added a comment.

Changed LIBUNWIND_ENABLE_PIC default to ON


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77370

Files:
  libunwind/CMakeLists.txt
  libunwind/docs/BuildingLibunwind.rst
  libunwind/src/CMakeLists.txt


Index: libunwind/src/CMakeLists.txt
===================================================================
--- libunwind/src/CMakeLists.txt
+++ libunwind/src/CMakeLists.txt
@@ -126,6 +126,9 @@
   else()
     target_compile_options(unwind_shared PRIVATE -fno-rtti)
   endif()
+  if(LIBUNWIND_ENABLE_PIC)
+    set_target_properties(unwind_shared PROPERTIES POSITION_INDEPENDENT_CODE ON)
+  endif()
   if(COMMAND llvm_setup_rpath)
     llvm_setup_rpath(unwind_shared)
   endif()
@@ -154,6 +157,9 @@
   else()
     target_compile_options(unwind_static PRIVATE -fno-rtti)
   endif()
+  if(LIBUNWIND_ENABLE_PIC)
+    set_target_properties(unwind_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
+  endif()
   target_link_libraries(unwind_static PRIVATE ${LIBUNWIND_LIBRARIES})
   set_target_properties(unwind_static PROPERTIES
     CXX_EXTENSIONS OFF
Index: libunwind/docs/BuildingLibunwind.rst
===================================================================
--- libunwind/docs/BuildingLibunwind.rst
+++ libunwind/docs/BuildingLibunwind.rst
@@ -130,6 +130,12 @@
 
   Build libunwind as a static archive.
 
+.. option:: LIBUNWIND_ENABLE_PIC:BOOL
+
+  **Default**: ``ON``
+
+  Build position-independent code, even in the static library.
+
 .. option:: LIBUNWIND_ENABLE_CROSS_UNWINDING:BOOL
 
   **Default**: ``OFF``
Index: libunwind/CMakeLists.txt
===================================================================
--- libunwind/CMakeLists.txt
+++ libunwind/CMakeLists.txt
@@ -131,6 +131,7 @@
 option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 option(LIBUNWIND_ENABLE_SHARED "Build libunwind as a shared library." ON)
 option(LIBUNWIND_ENABLE_STATIC "Build libunwind as a static library." ON)
+option(LIBUNWIND_ENABLE_PIC "Build position-independent code, even in the static library." ON)
 option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding support." OFF)
 option(LIBUNWIND_ENABLE_ARM_WMMX "Enable unwinding support for ARM WMMX registers." OFF)
 option(LIBUNWIND_ENABLE_THREADS "Build libunwind with threading support." ON)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77370.255015.patch
Type: text/x-patch
Size: 2071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200404/3336e683/attachment-0001.bin>


More information about the libcxx-commits mailing list