aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2021-01-12 16:49:47 +0000
committerxiphon <xiphon@protonmail.com>2021-01-16 19:28:05 +0000
commitc66e8d92e4a4a5029d8014e4fb1c96f26ab9d0ff (patch)
treeabe7f0eb87f695fdbbe88db26c68371da577d5a3 /CMakeLists.txt
parentMerge pull request #7221 (diff)
downloadmonero-c66e8d92e4a4a5029d8014e4fb1c96f26ab9d0ff.tar.xz
build: omit '-pie' linker flag in native non static WIN32 GCC builds
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt3
1 files changed, 2 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6d102ba7..d67ed7b9e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -714,9 +714,10 @@ else()
endif()
# linker
- if (NOT SANITIZE AND NOT OSSFUZZ AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1)))
+ if (NOT SANITIZE AND NOT OSSFUZZ AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND (CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1 OR NOT STATIC))))
# 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)
endif()
add_linker_flag_if_supported(-Wl,-z,relro LD_SECURITY_FLAGS)