forked from OSchip/llvm-project
[runtimes] Always build libc++, libc++abi and libunwind with -fPIC
Building the libraries with -fPIC ensures that we can link an executable against the static libraries with -fPIE. Furthermore, there is apparently basically no downside to building the libraries with position independent code, since modern toolchains are sufficiently clever. This commit enforces that we always build the runtime libraries with -fPIC. This is another take on D104327, which instead makes the decision of whether to build with -fPIC or not to the build script that drives the runtimes' build. Fixes http://llvm.org/PR43604. Differential Revision: https://reviews.llvm.org/D104328
This commit is contained in:
parent
45478619e3
commit
21c24ae902
|
@ -198,6 +198,7 @@ if (LIBCXX_ENABLE_SHARED)
|
|||
VERSION "${LIBCXX_ABI_VERSION}.0"
|
||||
SOVERSION "${LIBCXX_ABI_VERSION}"
|
||||
DEFINE_SYMBOL ""
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
cxx_add_common_build_flags(cxx_shared)
|
||||
cxx_set_common_defines(cxx_shared)
|
||||
|
@ -272,6 +273,7 @@ if (LIBCXX_ENABLE_STATIC)
|
|||
COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
|
||||
LINK_FLAGS "${LIBCXX_LINK_FLAGS}"
|
||||
OUTPUT_NAME "c++"
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
cxx_add_common_build_flags(cxx_static)
|
||||
cxx_set_common_defines(cxx_static)
|
||||
|
|
|
@ -191,6 +191,7 @@ if (LIBCXXABI_ENABLE_SHARED)
|
|||
SOVERSION "1"
|
||||
VERSION "${LIBCXXABI_LIBRARY_VERSION}"
|
||||
DEFINE_SYMBOL ""
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
|
||||
list(APPEND LIBCXXABI_BUILD_TARGETS "cxxabi_shared")
|
||||
|
@ -243,6 +244,7 @@ if (LIBCXXABI_ENABLE_STATIC)
|
|||
COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS}"
|
||||
LINK_FLAGS "${LIBCXXABI_LINK_FLAGS}"
|
||||
OUTPUT_NAME "c++abi"
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
|
||||
if(LIBCXXABI_HERMETIC_STATIC_LIBRARY)
|
||||
|
|
|
@ -141,6 +141,7 @@ if (LIBUNWIND_ENABLE_SHARED)
|
|||
OUTPUT_NAME "unwind"
|
||||
VERSION "1.0"
|
||||
SOVERSION "1"
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_shared")
|
||||
if (LIBUNWIND_INSTALL_SHARED_LIBRARY)
|
||||
|
@ -166,6 +167,7 @@ if (LIBUNWIND_ENABLE_STATIC)
|
|||
LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}"
|
||||
LINKER_LANGUAGE C
|
||||
OUTPUT_NAME "unwind"
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
|
||||
if(LIBUNWIND_HIDE_SYMBOLS)
|
||||
|
|
Loading…
Reference in New Issue