aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2021-06-01 22:05:45 -0500
committerluigi1111 <luigi1111w@gmail.com>2021-06-01 22:05:45 -0500
commit45007f35cff72f4bdd4f2621225c514f9cc4dc13 (patch)
treec773720e814358d857fd25c446f778dcdfeeb3e7 /CMakeLists.txt
parentMerge pull request #7697 (diff)
parentclang: fix -pie flag (diff)
downloadmonero-45007f35cff72f4bdd4f2621225c514f9cc4dc13.tar.xz
Merge pull request #7689
f93db0d clang: fix -pie flag (selsta)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fecea318b..23f680085 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -749,7 +749,12 @@ else()
# PIE executables randomly crash at startup with ASAN
# 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
- 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()
add_linker_flag_if_supported(-Wl,-z,relro LD_SECURITY_FLAGS)
add_linker_flag_if_supported(-Wl,-z,now LD_SECURITY_FLAGS)