File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -579,12 +579,32 @@ if(UMF_USE_MSAN)
579
579
"prevent reporting false-positives" )
580
580
add_sanitizer_flag(memory)
581
581
endif ()
582
+
582
583
# Fuzzer instrumentation for the whole library
583
584
if (UMF_BUILD_FUZZTESTS
584
585
AND CMAKE_CXX_COMPILER_ID MATCHES "Clang"
585
586
AND LINUX)
586
587
add_compile_options ("-fsanitize=fuzzer-no-link" )
587
588
add_link_options ("-fsanitize=fuzzer-no-link" )
589
+
590
+ # We need to find the fuzzer lib in the LLVM installation dir and link it
591
+ # statically
592
+ string (REGEX MATCH "^[0-9]+" CMAKE_C_COMPILER_MAJOR_VERSION ${CMAKE_C_COMPILER_VERSION} )
593
+ find_library (
594
+ FUZZER_NO_MAIN_LIB
595
+ NAMES libclang_rt.fuzzer_no_main-x86_64.a
596
+ PATHS
597
+ "/usr/lib/llvm-${CMAKE_C_COMPILER_MAJOR_VERSION} /lib/clang/${CMAKE_C_COMPILER_MAJOR_VERSION} /lib/linux/"
598
+ )
599
+
600
+ if (FUZZER_NO_MAIN_LIB)
601
+ message (STATUS "Found fuzzer lib: ${FUZZER_NO_MAIN_LIB} " )
602
+ # Fuzzer lib requires libstdc++
603
+ link_libraries (${FUZZER_NO_MAIN_LIB} "stdc++" )
604
+ else ()
605
+ message (FATAL_ERROR "libclang_rt.fuzzer_no_main-x86_64 not found!" )
606
+
607
+ endif ()
588
608
endif ()
589
609
590
610
# A header-only lib to specify include directories in transitive dependencies
You can’t perform that action at this time.
0 commit comments