Merge pull request #7689

f93db0d clang: fix -pie flag (selsta)
This commit is contained in:
luigi1111 2021-06-01 22:05:45 -05:00
commit 45007f35cf
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010
1 changed files with 6 additions and 1 deletions

View File

@ -749,7 +749,12 @@ else()
# PIE executables randomly crash at startup with ASAN # PIE executables randomly crash at startup with ASAN
# Windows binaries die on startup with PIE when compiled with GCC <9.x # Windows binaries die on startup with PIE when compiled with GCC <9.x
# Windows dynamically-linked binaries die on startup with PIE regardless of GCC version # Windows dynamically-linked binaries die on startup with PIE regardless of GCC version
add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS) if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# Clang does not support -pie flag
add_linker_flag_if_supported("-Wl,-pie" LD_SECURITY_FLAGS)
else()
add_linker_flag_if_supported("-pie" LD_SECURITY_FLAGS)
endif()
endif() endif()
add_linker_flag_if_supported(-Wl,-z,relro LD_SECURITY_FLAGS) add_linker_flag_if_supported(-Wl,-z,relro LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-z,now LD_SECURITY_FLAGS) add_linker_flag_if_supported(-Wl,-z,now LD_SECURITY_FLAGS)