Force PIE usage on linux (#625)

* force PIE usage on linux

* get rid of explicit -pie linker flag

* change UNIX with UNIX AND NOT APPLE in CMakeLists.txt

* cmake: add proper check for PIE support at link time

---------

Co-authored-by: Mikhail Paulyshka <me@mixaill.net>
This commit is contained in:
Random 2024-09-01 20:48:34 +02:00 committed by GitHub
parent 63d78aee0a
commit 0276ed92a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,6 +17,18 @@ endif()
project(shadPS4)
# Forcing PIE makes sure that the base address is high enough so that it doesn't clash with the PS4 memory.
if(UNIX AND NOT APPLE)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
# check PIE support at link time
include(CheckPIESupported)
check_pie_supported(OUTPUT_VARIABLE pie_check LANGUAGES C CXX)
if(NOT CMAKE_C_LINK_PIE_SUPPORTED OR NOT CMAKE_CXX_LINK_PIE_SUPPORTED)
message(WARNING "PIE is not supported at link time: ${pie_check}")
endif()
endif()
option(ENABLE_QT_GUI "Enable the Qt GUI. If not selected then the emulator uses a minimal SDL-based UI instead" OFF)
# This function should be passed a list of all files in a target. It will automatically generate file groups