fix(build): link the Linux library tests as PIE

The Linux loader takes the unnamed main image for guest code, as the
relinker's ET_DYN output is. Fedora's GCC does not default to PIE, so the
test executables were ET_EXEC and three loader tests failed.
This commit is contained in:
ThatsLeo 2026-10-10 15:57:34 +02:00 committed by MarcZX100
parent 57f96fd2b3
commit c2a159bab7
1 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,12 @@ if(NOT WIN32)
string(STRIP "${CMAKE_EXE_LINKER_FLAGS}" CMAKE_EXE_LINKER_FLAGS)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
include(CheckPIESupported)
check_pie_supported(LANGUAGES C CXX)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
add_executable(nid_patcher
${CMAKE_CURRENT_SOURCE_DIR}/nid/src/Sha1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nid/src/NidCompute.cpp