diff options
author | luigi1111 <luigi1111w@gmail.com> | 2020-05-27 18:27:06 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2020-05-27 18:27:06 -0500 |
commit | d6d4a03b8599df3975eb351365273916b3d2f594 (patch) | |
tree | e13fd39b6b992a95d230565a84093b80e0fde9bb /CMakeLists.txt | |
parent | Merge pull request #6531 (diff) | |
parent | cmake: ASAN and PIE don't mix (diff) | |
download | monero-d6d4a03b8599df3975eb351365273916b3d2f594.tar.xz |
Merge pull request #6535
81773f5 fuzz_tests: refactor and add OSS-Fuzz compatibility (moneromooo-monero)
cb4edc1 cmake: ASAN and PIE don't mix (moneromooo-monero)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d9ec866e4..4fcf782aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -262,6 +262,12 @@ else() endif() option(BUILD_DEBUG_UTILITIES "Build debug utilities." DEFAULT_BUILD_DEBUG_UTILITIES) +if(OSSFUZZ) + message(STATUS "Using OSS-Fuzz fuzzing system") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOSSFUZZ") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOSSFUZZ") +endif() + # Check whether we're on a 32-bit or 64-bit system if(CMAKE_SIZEOF_VOID_P EQUAL "8") set(DEFAULT_BUILD_64 ON) @@ -646,7 +652,8 @@ else() endif() # linker - if (NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1))) + if (NOT SANITIZE AND NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1))) + # PIE executables randomly crash at startup with ASAN # Windows binaries die on startup with PIE when compiled with GCC <9.x add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS) endif() @@ -768,7 +775,8 @@ else() endif(ARM) - if(ANDROID AND NOT BUILD_GUI_DEPS STREQUAL "ON" OR IOS) + # random crash on startup when asan is on if pie is enabled + if(NOT SANITIZE AND ANDROID AND NOT BUILD_GUI_DEPS STREQUAL "ON" OR IOS) #From Android 5: "only position independent executables (PIE) are supported" message(STATUS "Enabling PIE executable") set(PIC_FLAG "") |