CMake: Enable PIC on Linux
Otherwise ASLR does not work. Also stops LTO builds crashing in the middle of Qt on Fedora.
This commit is contained in:
parent
fbe2d46873
commit
0c3051e35f
|
@ -34,6 +34,13 @@ detect_cache_line_size()
|
||||||
# Build options. Depends on system attributes.
|
# Build options. Depends on system attributes.
|
||||||
include(DuckStationBuildOptions)
|
include(DuckStationBuildOptions)
|
||||||
|
|
||||||
|
# Enable PIC on Linux, otherwise the builds do not support ASLR.
|
||||||
|
if(LINUX OR BSD)
|
||||||
|
include(CheckPIESupported)
|
||||||
|
check_pie_supported()
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Set _DEBUG macro for Debug builds.
|
# Set _DEBUG macro for Debug builds.
|
||||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||||
|
|
|
@ -143,7 +143,7 @@ echo "Building libbacktrace..."
|
||||||
rm -fr "libbacktrace-$LIBBACKTRACE"
|
rm -fr "libbacktrace-$LIBBACKTRACE"
|
||||||
unzip "$LIBBACKTRACE.zip"
|
unzip "$LIBBACKTRACE.zip"
|
||||||
cd "libbacktrace-$LIBBACKTRACE"
|
cd "libbacktrace-$LIBBACKTRACE"
|
||||||
./configure --prefix="$INSTALLDIR"
|
./configure --prefix="$INSTALLDIR" --with-pic
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
cd ..
|
cd ..
|
||||||
|
|
Loading…
Reference in New Issue