llvm.org GIT mirror llvm / 91e5590
Update LLVM fuzzers to use the libFuzzer bundled with the compiler toolchain Differential Revision: https://reviews.llvm.org/D37041 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311515 91177308-0d34-0410-b5e6-96231b3b80d8 George Karpenkov 2 years ago
8 changed file(s) with 16 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
663663 FSANITIZE_USE_AFTER_SCOPE_FLAG)
664664 endif()
665665 if (LLVM_USE_SANITIZE_COVERAGE)
666 append("-fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
666 append("-fsanitize=fuzzer-no-link" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
667667 endif()
668668 endif()
669669
0 if( LLVM_USE_SANITIZE_COVERAGE )
1
2 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
13 set(LLVM_LINK_COMPONENTS
24 AsmParser
35 BitWriter
46 Core
57 Support
68 )
7 add_llvm_tool(llvm-as-fuzzer
9 add_llvm_tool(llvm-as-fuzzer
810 llvm-as-fuzzer.cpp)
9 target_link_libraries(llvm-as-fuzzer
10 LLVMFuzzer
11 )
1211 endif()
33 Support
44 )
55
6 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
7
68 add_llvm_executable(llvm-dwarfdump-fuzzer
79 EXCLUDE_FROM_ALL
810 llvm-dwarfdump-fuzzer.cpp
911 )
10
11 target_link_libraries(llvm-dwarfdump-fuzzer
12 LLVMFuzzer
13 )
3131 }
3232 ObjectFile &Obj = *ObjOrErr.get();
3333 std::unique_ptr DICtx = DWARFContext::create(Obj);
34 DICtx->dump(nulls(), DIDT_All);
34
35
36 DIDumpOptions opts;
37 opts.DumpType = DIDT_All;
38 DICtx->dump(nulls(), opts);
3539 }
0 if( LLVM_USE_SANITIZE_COVERAGE )
1 include_directories(BEFORE
2 ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/Fuzzer)
1 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
32
43 set(LLVM_LINK_COMPONENTS
54 AllTargetsAsmPrinters
109 MCParser
1110 Support
1211 )
13 add_llvm_tool(llvm-mc-assemble-fuzzer
12
13 add_llvm_tool(llvm-mc-assemble-fuzzer
1414 llvm-mc-assemble-fuzzer.cpp)
15 target_link_libraries(llvm-mc-assemble-fuzzer
16 LLVMFuzzer
17 )
1815 endif()
88 //
99 //===----------------------------------------------------------------------===//
1010
11 #include "FuzzerInterface.h"
1211 #include "llvm-c/Target.h"
1312 #include "llvm/MC/SubtargetFeature.h"
1413 #include "llvm/MC/MCAsmBackend.h"
0 if( LLVM_USE_SANITIZE_COVERAGE )
1 include_directories(BEFORE
2 ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/Fuzzer)
31
2 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
43 set(LLVM_LINK_COMPONENTS
54 AllTargetsAsmPrinters
65 AllTargetsDescs
1110 MCParser
1211 Support
1312 )
14 add_llvm_tool(llvm-mc-disassemble-fuzzer
13 add_llvm_tool(llvm-mc-disassemble-fuzzer
1514 llvm-mc-disassemble-fuzzer.cpp)
16
17 target_link_libraries(llvm-mc-disassemble-fuzzer
18 LLVMFuzzer
19 )
2015 endif()
88 //
99 //===----------------------------------------------------------------------===//
1010
11 #include "FuzzerInterface.h"
1211 #include "llvm-c/Disassembler.h"
1312 #include "llvm-c/Target.h"
1413 #include "llvm/MC/SubtargetFeature.h"