mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-11 09:25:20 +00:00
wasm-mutator-fuzz: Adapt to oss-fuzz compilation (#3464)
This commit is contained in:
parent
3b8ef89110
commit
a9eff69dd9
|
@ -5,8 +5,6 @@ cmake_minimum_required (VERSION 2.8)
|
|||
|
||||
project(wasm_mutator)
|
||||
|
||||
add_definitions(-DUNIT_TEST)
|
||||
|
||||
set (CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
set (CMAKE_C_COMPILER "clang")
|
||||
|
@ -43,10 +41,6 @@ if(CUSTOM_MUTATOR EQUAL 1)
|
|||
add_compile_definitions(CUSTOM_MUTATOR)
|
||||
endif()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_INTERP)
|
||||
# Enable Interpreter by default
|
||||
set (WAMR_BUILD_INTERP 1)
|
||||
|
@ -120,13 +114,22 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
|||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
add_definitions(-DWAMR_USE_MEM_POOL=0)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=signed-integer-overflow \
|
||||
-fprofile-instr-generate -fcoverage-mapping \
|
||||
-fsanitize=address,undefined,fuzzer")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=signed-integer-overflow \
|
||||
-fprofile-instr-generate -fcoverage-mapping \
|
||||
-fsanitize=address,undefined,fuzzer")
|
||||
|
||||
|
||||
# Enable fuzzer
|
||||
add_compile_options(-fsanitize=fuzzer)
|
||||
add_link_options(-fsanitize=fuzzer)
|
||||
|
||||
# if not calling from oss-fuzz helper, enable all support sanitizers
|
||||
# oss-fuzz always defines `HELPER=True`
|
||||
if (NOT "$ENV{HELPER}" STREQUAL "True")
|
||||
add_compile_options(
|
||||
-fsanitize=signed-integer-overflow
|
||||
-fprofile-instr-generate -fcoverage-mapping
|
||||
-fsanitize=address,undefined
|
||||
)
|
||||
add_link_options(-fsanitize=address)
|
||||
endif ()
|
||||
|
||||
include(${REPO_ROOT_DIR}/core/shared/utils/uncommon/shared_uncommon.cmake)
|
||||
include(${REPO_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
||||
|
||||
|
@ -135,4 +138,4 @@ add_library(vmlib
|
|||
)
|
||||
|
||||
add_executable(wasm_mutator_fuzz wasm_mutator_fuzz.cc)
|
||||
target_link_libraries(wasm_mutator_fuzz vmlib -lm)
|
||||
target_link_libraries(wasm_mutator_fuzz vmlib -lm)
|
||||
|
|
|
@ -5,8 +5,6 @@ cmake_minimum_required (VERSION 2.8)
|
|||
|
||||
project(wasm_mutator)
|
||||
|
||||
add_definitions(-DUNIT_TEST)
|
||||
|
||||
set (CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
set (CMAKE_C_COMPILER "clang")
|
||||
|
@ -43,10 +41,6 @@ if(CUSTOM_MUTATOR EQUAL 1)
|
|||
add_compile_definitions(CUSTOM_MUTATOR)
|
||||
endif()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_INTERP)
|
||||
# Enable Interpreter by default
|
||||
set (WAMR_BUILD_INTERP 1)
|
||||
|
@ -120,19 +114,28 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
|||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
add_definitions(-DWAMR_USE_MEM_POOL=0)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=signed-integer-overflow \
|
||||
-fprofile-instr-generate -fcoverage-mapping \
|
||||
-fsanitize=address,undefined,fuzzer")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=signed-integer-overflow \
|
||||
-fprofile-instr-generate -fcoverage-mapping \
|
||||
-fsanitize=address,undefined,fuzzer")
|
||||
|
||||
include(${REPO_ROOT_DIR}/wamr/core/shared/utils/uncommon/shared_uncommon.cmake)
|
||||
include(${REPO_ROOT_DIR}/wamr/build-scripts/runtime_lib.cmake)
|
||||
|
||||
# Enable fuzzer
|
||||
add_compile_options(-fsanitize=fuzzer)
|
||||
add_link_options(-fsanitize=fuzzer)
|
||||
|
||||
# if not calling from oss-fuzz helper, enable all support sanitizers
|
||||
# oss-fuzz always defines `HELPER=True`
|
||||
if (NOT "$ENV{HELPER}" STREQUAL "True")
|
||||
add_compile_options(
|
||||
-fsanitize=signed-integer-overflow
|
||||
-fprofile-instr-generate -fcoverage-mapping
|
||||
-fsanitize=address,undefined
|
||||
)
|
||||
add_link_options(-fsanitize=address)
|
||||
endif ()
|
||||
|
||||
include(${REPO_ROOT_DIR}/core/shared/utils/uncommon/shared_uncommon.cmake)
|
||||
include(${REPO_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
||||
|
||||
add_library(vmlib
|
||||
${WAMR_RUNTIME_LIB_SOURCE}
|
||||
)
|
||||
|
||||
add_executable(wasm_mutator_fuzz wasm_mutator_fuzz.cc)
|
||||
target_link_libraries(wasm_mutator_fuzz vmlib -lm)
|
||||
target_link_libraries(wasm_mutator_fuzz vmlib -lm)
|
||||
|
|
Loading…
Reference in New Issue
Block a user