aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorselsta <selsta@sent.at>2021-04-27 05:50:16 +0200
committerselsta <selsta@sent.at>2021-04-27 09:52:34 +0200
commitf93db0d46a3c7a4e2d09104ef8207992f8e7c347 (patch)
tree208b9796d3e11211986e4fb862b9ec7a80b8590c
parentMerge pull request #7669 (diff)
downloadmonero-f93db0d46a3c7a4e2d09104ef8207992f8e7c347.tar.xz
clang: fix -pie flag
-rw-r--r--CMakeLists.txt7
1 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e858b3aaf..06dcd7201 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -737,7 +737,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)