Add fuzzer instrumentation when building fuzzers
Without this the fuzzing is unguided and takes exponentially more time to find interesting corpus cases. Change-Id: I1b66de153bc41a829a5276a02a729f4e6bb50ef0 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33722 Reviewed-by: David Neto <dneto@google.com> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com> Auto-Submit: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
1b543c6778
commit
12ed862c7e
|
@ -14,20 +14,9 @@
|
|||
|
||||
function(add_tint_fuzzer NAME)
|
||||
add_executable(${NAME} ${NAME}.cc)
|
||||
target_link_libraries(${NAME} libtint)
|
||||
target_link_libraries(${NAME} libtint-fuzz)
|
||||
tint_default_compile_options(${NAME})
|
||||
target_link_options(${NAME} PRIVATE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=fuzzer,address,undefined
|
||||
-fsanitize-address-use-after-scope
|
||||
-O1
|
||||
-g
|
||||
)
|
||||
|
||||
target_compile_options(${NAME} PRIVATE
|
||||
-fsanitize=fuzzer,address,undefined
|
||||
-Wno-missing-prototypes
|
||||
)
|
||||
target_compile_options(${NAME} PRIVATE -Wno-missing-prototypes)
|
||||
endfunction()
|
||||
|
||||
if (${TINT_BUILD_WGSL_READER})
|
||||
|
|
|
@ -435,10 +435,24 @@ if (${COMPILER_IS_LIKE_GNU})
|
|||
target_compile_options(libtint PRIVATE -fvisibility=hidden)
|
||||
endif()
|
||||
|
||||
if (${TINT_BUILD_FUZZERS})
|
||||
# Tint library with fuzzer instrumentation
|
||||
add_library(libtint-fuzz ${TINT_LIB_SRCS})
|
||||
tint_default_compile_options(libtint-fuzz)
|
||||
if (${COMPILER_IS_LIKE_GNU})
|
||||
target_compile_options(libtint-fuzz PRIVATE -fvisibility=hidden)
|
||||
endif()
|
||||
target_compile_options(libtint-fuzz PUBLIC -fsanitize=fuzzer -fsanitize-coverage=trace-cmp)
|
||||
target_link_options(libtint-fuzz PUBLIC -fsanitize=fuzzer -fsanitize-coverage=trace-cmp)
|
||||
endif()
|
||||
|
||||
set_target_properties(libtint PROPERTIES OUTPUT_NAME "tint")
|
||||
|
||||
if(${TINT_BUILD_SPV_READER} OR ${TINT_BUILD_SPV_WRITER})
|
||||
tint_spvtools_compile_options(libtint)
|
||||
if (${TINT_BUILD_FUZZERS})
|
||||
tint_spvtools_compile_options(libtint-fuzz)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${TINT_BUILD_SPV_READER})
|
||||
|
|
Loading…
Reference in New Issue