mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
cmake: Invent add_llvm_fuzzer to set up fuzzer targets
This moves the cmake configuration for fuzzers in LLVM to a new macro, add_llvm_fuzzer. This will make it easier to keep things consistent while implementing llvm.org/pr34314. I've also made a couple of minor functional changes here: - the fuzzers now use add_llvm_executable rather than add_llvm_tool. This means they won't create install targets and stuff like that, because those made little sense for these fuzzers. - I've grouped these under "Fuzzers" rather than in with "Tools" for people who build with IDEs. llvm-svn: 312200
This commit is contained in:
parent
c8d8d61958
commit
1f7d4b581a
@ -892,6 +892,13 @@ macro(add_llvm_utility name)
|
||||
endif()
|
||||
endmacro(add_llvm_utility name)
|
||||
|
||||
macro(add_llvm_fuzzer name)
|
||||
if( LLVM_USE_SANITIZE_COVERAGE )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
|
||||
add_llvm_executable(${name} ${ARGN})
|
||||
set_target_properties(${name} PROPERTIES FOLDER "Fuzzers")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(add_llvm_target target_name)
|
||||
include_directories(BEFORE
|
||||
|
@ -1,12 +1,7 @@
|
||||
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
|
||||
llvm-as-fuzzer.cpp)
|
||||
endif()
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
AsmParser
|
||||
BitWriter
|
||||
Core
|
||||
Support
|
||||
)
|
||||
add_llvm_fuzzer(llvm-as-fuzzer llvm-as-fuzzer.cpp)
|
||||
|
@ -11,6 +11,4 @@ add_llvm_tool(llvm-dwarfdump
|
||||
llvm-dwarfdump.cpp
|
||||
)
|
||||
|
||||
if(LLVM_USE_SANITIZE_COVERAGE)
|
||||
add_subdirectory(fuzzer)
|
||||
endif()
|
||||
add_subdirectory(fuzzer)
|
||||
|
@ -4,9 +4,7 @@ set(LLVM_LINK_COMPONENTS
|
||||
Support
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
|
||||
|
||||
add_llvm_executable(llvm-dwarfdump-fuzzer
|
||||
add_llvm_fuzzer(llvm-dwarfdump-fuzzer
|
||||
EXCLUDE_FROM_ALL
|
||||
llvm-dwarfdump-fuzzer.cpp
|
||||
)
|
||||
|
@ -1,20 +1,15 @@
|
||||
if( LLVM_USE_SANITIZE_COVERAGE )
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
${LLVM_TARGETS_TO_BUILD}
|
||||
Analysis
|
||||
AsmPrinter
|
||||
CodeGen
|
||||
Core
|
||||
FuzzMutate
|
||||
IRReader
|
||||
MC
|
||||
ScalarOpts
|
||||
SelectionDAG
|
||||
Support
|
||||
Target
|
||||
)
|
||||
add_llvm_tool(llvm-isel-fuzzer
|
||||
llvm-isel-fuzzer.cpp)
|
||||
endif()
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
${LLVM_TARGETS_TO_BUILD}
|
||||
Analysis
|
||||
AsmPrinter
|
||||
CodeGen
|
||||
Core
|
||||
FuzzMutate
|
||||
IRReader
|
||||
MC
|
||||
ScalarOpts
|
||||
SelectionDAG
|
||||
Support
|
||||
Target
|
||||
)
|
||||
add_llvm_fuzzer(llvm-isel-fuzzer llvm-isel-fuzzer.cpp)
|
||||
|
@ -1,16 +1,10 @@
|
||||
if( LLVM_USE_SANITIZE_COVERAGE )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
|
||||
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
AllTargetsAsmPrinters
|
||||
AllTargetsAsmParsers
|
||||
AllTargetsDescs
|
||||
AllTargetsInfos
|
||||
MC
|
||||
MCParser
|
||||
Support
|
||||
)
|
||||
|
||||
add_llvm_tool(llvm-mc-assemble-fuzzer
|
||||
llvm-mc-assemble-fuzzer.cpp)
|
||||
endif()
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
AllTargetsAsmPrinters
|
||||
AllTargetsAsmParsers
|
||||
AllTargetsDescs
|
||||
AllTargetsInfos
|
||||
MC
|
||||
MCParser
|
||||
Support
|
||||
)
|
||||
add_llvm_fuzzer(llvm-mc-assemble-fuzzer llvm-mc-assemble-fuzzer.cpp)
|
||||
|
@ -1,16 +1,11 @@
|
||||
if( LLVM_USE_SANITIZE_COVERAGE )
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
AllTargetsAsmPrinters
|
||||
AllTargetsDescs
|
||||
AllTargetsDisassemblers
|
||||
AllTargetsInfos
|
||||
MC
|
||||
MCDisassembler
|
||||
MCParser
|
||||
Support
|
||||
)
|
||||
add_llvm_tool(llvm-mc-disassemble-fuzzer
|
||||
llvm-mc-disassemble-fuzzer.cpp)
|
||||
endif()
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
AllTargetsAsmPrinters
|
||||
AllTargetsDescs
|
||||
AllTargetsDisassemblers
|
||||
AllTargetsInfos
|
||||
MC
|
||||
MCDisassembler
|
||||
MCParser
|
||||
Support
|
||||
)
|
||||
add_llvm_fuzzer(llvm-mc-disassemble-fuzzer llvm-mc-disassemble-fuzzer.cpp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user