Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 91e5590

Browse files
author
George Karpenkov
committed
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
1 parent eaf0747 commit 91e5590

File tree

8 files changed

+16
-25
lines changed

8 files changed

+16
-25
lines changed

cmake/modules/HandleLLVMOptions.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ if(LLVM_USE_SANITIZER)
664664
FSANITIZE_USE_AFTER_SCOPE_FLAG)
665665
endif()
666666
if (LLVM_USE_SANITIZE_COVERAGE)
667-
append("-fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
667+
append("-fsanitize=fuzzer-no-link" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
668668
endif()
669669
endif()
670670

tools/llvm-as-fuzzer/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
if( LLVM_USE_SANITIZE_COVERAGE )
2+
3+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
24
set(LLVM_LINK_COMPONENTS
35
AsmParser
46
BitWriter
57
Core
68
Support
79
)
8-
add_llvm_tool(llvm-as-fuzzer
10+
add_llvm_tool(llvm-as-fuzzer
911
llvm-as-fuzzer.cpp)
10-
target_link_libraries(llvm-as-fuzzer
11-
LLVMFuzzer
12-
)
1312
endif()

tools/llvm-dwarfdump/fuzzer/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ set(LLVM_LINK_COMPONENTS
44
Support
55
)
66

7+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
8+
79
add_llvm_executable(llvm-dwarfdump-fuzzer
810
EXCLUDE_FROM_ALL
911
llvm-dwarfdump-fuzzer.cpp
1012
)
11-
12-
target_link_libraries(llvm-dwarfdump-fuzzer
13-
LLVMFuzzer
14-
)

tools/llvm-dwarfdump/fuzzer/llvm-dwarfdump-fuzzer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@ extern "C" void LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
3232
}
3333
ObjectFile &Obj = *ObjOrErr.get();
3434
std::unique_ptr<DIContext> DICtx = DWARFContext::create(Obj);
35-
DICtx->dump(nulls(), DIDT_All);
35+
36+
37+
DIDumpOptions opts;
38+
opts.DumpType = DIDT_All;
39+
DICtx->dump(nulls(), opts);
3640
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
if( LLVM_USE_SANITIZE_COVERAGE )
2-
include_directories(BEFORE
3-
${CMAKE_CURRENT_SOURCE_DIR}/../../lib/Fuzzer)
2+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
43

54
set(LLVM_LINK_COMPONENTS
65
AllTargetsAsmPrinters
@@ -11,9 +10,7 @@ if( LLVM_USE_SANITIZE_COVERAGE )
1110
MCParser
1211
Support
1312
)
14-
add_llvm_tool(llvm-mc-assemble-fuzzer
13+
14+
add_llvm_tool(llvm-mc-assemble-fuzzer
1515
llvm-mc-assemble-fuzzer.cpp)
16-
target_link_libraries(llvm-mc-assemble-fuzzer
17-
LLVMFuzzer
18-
)
1916
endif()

tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
#include "FuzzerInterface.h"
1312
#include "llvm-c/Target.h"
1413
#include "llvm/MC/SubtargetFeature.h"
1514
#include "llvm/MC/MCAsmBackend.h"
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
if( LLVM_USE_SANITIZE_COVERAGE )
2-
include_directories(BEFORE
3-
${CMAKE_CURRENT_SOURCE_DIR}/../../lib/Fuzzer)
42

3+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
54
set(LLVM_LINK_COMPONENTS
65
AllTargetsAsmPrinters
76
AllTargetsDescs
@@ -12,10 +11,6 @@ if( LLVM_USE_SANITIZE_COVERAGE )
1211
MCParser
1312
Support
1413
)
15-
add_llvm_tool(llvm-mc-disassemble-fuzzer
14+
add_llvm_tool(llvm-mc-disassemble-fuzzer
1615
llvm-mc-disassemble-fuzzer.cpp)
17-
18-
target_link_libraries(llvm-mc-disassemble-fuzzer
19-
LLVMFuzzer
20-
)
2116
endif()

tools/llvm-mc-disassemble-fuzzer/llvm-mc-disassemble-fuzzer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
#include "FuzzerInterface.h"
1312
#include "llvm-c/Disassembler.h"
1413
#include "llvm-c/Target.h"
1514
#include "llvm/MC/SubtargetFeature.h"

0 commit comments

Comments
 (0)