[libunwind] r314834 - build: use POSITION_INDEPENDENT_CODE instead of -fPIC
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 3 13:22:26 PDT 2017
Author: compnerd
Date: Tue Oct 3 13:22:26 2017
New Revision: 314834
URL: http://llvm.org/viewvc/llvm-project?rev=314834&view=rev
Log:
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.
Modified:
libunwind/trunk/cmake/config-ix.cmake
libunwind/trunk/src/CMakeLists.txt
Modified: libunwind/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/cmake/config-ix.cmake?rev=314834&r1=314833&r2=314834&view=diff
==============================================================================
--- libunwind/trunk/cmake/config-ix.cmake (original)
+++ libunwind/trunk/cmake/config-ix.cmake Tue Oct 3 13:22:26 2017
@@ -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)
Modified: libunwind/trunk/src/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=314834&r1=314833&r2=314834&view=diff
==============================================================================
--- libunwind/trunk/src/CMakeLists.txt (original)
+++ libunwind/trunk/src/CMakeLists.txt Tue Oct 3 13:22:26 2017
@@ -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 ${LIBU
set_target_properties(unwind_objects
PROPERTIES
- COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}")
+ COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}"
+ POSITION_INDEPENDENT_CODE ON)
set(LIBUNWIND_TARGETS)
More information about the cfe-commits
mailing list