1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Update LLVM fuzzers to use the libFuzzer bundled with the compiler toolchain

Differential Revision: https://reviews.llvm.org/D37041

llvm-svn: 311515
This commit is contained in:
George Karpenkov 2017-08-23 00:40:58 +00:00
parent 1871702a49
commit e4d95d0f5e
8 changed files with 16 additions and 25 deletions

View File

@ -664,7 +664,7 @@ if(LLVM_USE_SANITIZER)
FSANITIZE_USE_AFTER_SCOPE_FLAG)
endif()
if (LLVM_USE_SANITIZE_COVERAGE)
append("-fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
append("-fsanitize=fuzzer-no-link" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
endif()

View File

@ -1,13 +1,12 @@
if( LLVM_USE_SANITIZE_COVERAGE )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
set(LLVM_LINK_COMPONENTS
AsmParser
BitWriter
Core
Support
)
add_llvm_tool(llvm-as-fuzzer
add_llvm_tool(llvm-as-fuzzer
llvm-as-fuzzer.cpp)
target_link_libraries(llvm-as-fuzzer
LLVMFuzzer
)
endif()

View File

@ -4,11 +4,9 @@ set(LLVM_LINK_COMPONENTS
Support
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
add_llvm_executable(llvm-dwarfdump-fuzzer
EXCLUDE_FROM_ALL
llvm-dwarfdump-fuzzer.cpp
)
target_link_libraries(llvm-dwarfdump-fuzzer
LLVMFuzzer
)

View File

@ -32,5 +32,9 @@ extern "C" void LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
}
ObjectFile &Obj = *ObjOrErr.get();
std::unique_ptr<DIContext> DICtx = DWARFContext::create(Obj);
DICtx->dump(nulls(), DIDT_All);
DIDumpOptions opts;
opts.DumpType = DIDT_All;
DICtx->dump(nulls(), opts);
}

View File

@ -1,6 +1,5 @@
if( LLVM_USE_SANITIZE_COVERAGE )
include_directories(BEFORE
${CMAKE_CURRENT_SOURCE_DIR}/../../lib/Fuzzer)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
set(LLVM_LINK_COMPONENTS
AllTargetsAsmPrinters
@ -11,9 +10,7 @@ if( LLVM_USE_SANITIZE_COVERAGE )
MCParser
Support
)
add_llvm_tool(llvm-mc-assemble-fuzzer
add_llvm_tool(llvm-mc-assemble-fuzzer
llvm-mc-assemble-fuzzer.cpp)
target_link_libraries(llvm-mc-assemble-fuzzer
LLVMFuzzer
)
endif()

View File

@ -9,7 +9,6 @@
//
//===----------------------------------------------------------------------===//
#include "FuzzerInterface.h"
#include "llvm-c/Target.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/MC/MCAsmBackend.h"

View File

@ -1,7 +1,6 @@
if( LLVM_USE_SANITIZE_COVERAGE )
include_directories(BEFORE
${CMAKE_CURRENT_SOURCE_DIR}/../../lib/Fuzzer)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
set(LLVM_LINK_COMPONENTS
AllTargetsAsmPrinters
AllTargetsDescs
@ -12,10 +11,6 @@ if( LLVM_USE_SANITIZE_COVERAGE )
MCParser
Support
)
add_llvm_tool(llvm-mc-disassemble-fuzzer
add_llvm_tool(llvm-mc-disassemble-fuzzer
llvm-mc-disassemble-fuzzer.cpp)
target_link_libraries(llvm-mc-disassemble-fuzzer
LLVMFuzzer
)
endif()

View File

@ -9,7 +9,6 @@
//
//===----------------------------------------------------------------------===//
#include "FuzzerInterface.h"
#include "llvm-c/Disassembler.h"
#include "llvm-c/Target.h"
#include "llvm/MC/SubtargetFeature.h"