summaryrefslogtreecommitdiff
path: root/libunwind
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2017-10-03 20:22:26 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2017-10-03 20:22:26 +0000
commit6b2e181d271935d7f038ca0eb122420954a92dec (patch)
treeb64ea88a0feb47f6586913d14feed5f0eb2bc563 /libunwind
parentb0fd5e59d7f6586e4c15c3a82c046812b6012251 (diff)
build: use POSITION_INDEPENDENT_CODE instead of -fPIC
Rather than hardcode the flag and check if the compiler supports it, use the CMake property to get the right flag spelling for the compiler. This makes it generally more portable.
Diffstat (limited to 'libunwind')
-rw-r--r--libunwind/cmake/config-ix.cmake1
-rw-r--r--libunwind/src/CMakeLists.txt4
2 files changed, 2 insertions, 3 deletions
diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake
index e2041afadab..2d4da649f6d 100644
--- a/libunwind/cmake/config-ix.cmake
+++ b/libunwind/cmake/config-ix.cmake
@@ -52,7 +52,6 @@ endif ()
# Check compiler flags
check_c_compiler_flag(-funwind-tables LIBUNWIND_HAS_FUNWIND_TABLES)
-check_cxx_compiler_flag(-fPIC LIBUNWIND_HAS_FPIC_FLAG)
check_cxx_compiler_flag(-fno-exceptions LIBUNWIND_HAS_NO_EXCEPTIONS_FLAG)
check_cxx_compiler_flag(-fno-rtti LIBUNWIND_HAS_NO_RTTI_FLAG)
check_cxx_compiler_flag(-fstrict-aliasing LIBUNWIND_HAS_FSTRICT_ALIASING_FLAG)
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 0b2a7c9977c..d1659589676 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -57,7 +57,6 @@ if (LIBUNWIND_ENABLE_THREADS)
endif()
# Setup flags.
-append_if(LIBUNWIND_COMPILE_FLAGS LIBUNWIND_HAS_FPIC_FLAG -fPIC)
append_if(LIBUNWIND_CXX_FLAGS LIBUNWIND_HAS_NO_RTTI_FLAG -fno-rtti)
append_if(LIBUNWIND_LINK_FLAGS LIBUNWIND_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
@@ -100,7 +99,8 @@ add_library(unwind_objects OBJECT ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
set_target_properties(unwind_objects
PROPERTIES
- COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}")
+ COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}"
+ POSITION_INDEPENDENT_CODE ON)
set(LIBUNWIND_TARGETS)