r315355 - Revert "[clang-fuzzer] Allow building without coverage instrumentation."
Matt Morehouse via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 10 13:13:13 PDT 2017
Author: morehouse
Date: Tue Oct 10 13:13:13 2017
New Revision: 315355
URL: http://llvm.org/viewvc/llvm-project?rev=315355&view=rev
Log:
Revert "[clang-fuzzer] Allow building without coverage instrumentation."
This reverts r315336 due to build breakage with gcc.
http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror/builds/2173
Removed:
cfe/trunk/tools/clang-fuzzer/DummyClangFuzzer.cpp
Modified:
cfe/trunk/tools/clang-fuzzer/CMakeLists.txt
cfe/trunk/tools/clang-fuzzer/ClangFuzzer.cpp
Modified: cfe/trunk/tools/clang-fuzzer/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-fuzzer/CMakeLists.txt?rev=315355&r1=315354&r2=315355&view=diff
==============================================================================
--- cfe/trunk/tools/clang-fuzzer/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-fuzzer/CMakeLists.txt Tue Oct 10 13:13:13 2017
@@ -1,66 +1,60 @@
-set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} FuzzMutate)
-set(CXX_FLAGS_NOFUZZ ${CMAKE_CXX_FLAGS})
-set(DUMMY_MAIN DummyClangFuzzer.cpp)
-if(LLVM_USE_SANITIZE_COVERAGE)
+if( LLVM_USE_SANITIZE_COVERAGE )
+ set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD})
+ set(CXX_FLAGS_NOFUZZ "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer-no-link")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=fuzzer")
- set(CXX_FLAGS_NOFUZZ "${CXX_FLAGS_NOFUZZ} -fsanitize=fuzzer-no-link")
- unset(DUMMY_MAIN)
-endif()
-
-# Hack to bypass LLVM's cmake sources check and allow multiple libraries and
-# executables from this directory.
-set(LLVM_OPTIONAL_SOURCES
- ClangFuzzer.cpp
- DummyClangFuzzer.cpp
- ExampleClangProtoFuzzer.cpp
- )
-
-if(CLANG_ENABLE_PROTO_FUZZER)
- # Create protobuf .h and .cc files, and put them in a library for use by
- # clang-proto-fuzzer components.
- find_package(Protobuf REQUIRED)
- add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI)
- include_directories(${PROTOBUF_INCLUDE_DIRS})
- include_directories(${CMAKE_CURRENT_BINARY_DIR})
- protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS cxx_proto.proto)
- set(LLVM_OPTIONAL_SOURCES ${LLVM_OPTIONAL_SOURCES} ${PROTO_SRCS})
- add_clang_library(clangCXXProto
- ${PROTO_SRCS}
- ${PROTO_HDRS}
-
- LINK_LIBS
- ${PROTOBUF_LIBRARIES}
- )
- # Build and include libprotobuf-mutator
- include(ProtobufMutator)
- include_directories(${ProtobufMutator_INCLUDE_DIRS})
-
- # Build the protobuf->C++ translation library and driver.
- add_clang_subdirectory(proto-to-cxx)
-
- # Build the protobuf fuzzer
- add_clang_executable(clang-proto-fuzzer
- ${DUMMY_MAIN}
- ExampleClangProtoFuzzer.cpp
+ if(CLANG_ENABLE_PROTO_FUZZER)
+ # Create protobuf .h and .cc files, and put them in a library for use by
+ # clang-proto-fuzzer components.
+ find_package(Protobuf REQUIRED)
+ add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI)
+ include_directories(${PROTOBUF_INCLUDE_DIRS})
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
+ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS cxx_proto.proto)
+ # Hack to bypass LLVM's cmake sources check and allow multiple libraries and
+ # executables from this directory.
+ set(LLVM_OPTIONAL_SOURCES
+ ClangFuzzer.cpp
+ ExampleClangProtoFuzzer.cpp
+ ${PROTO_SRCS}
+ )
+ add_clang_library(clangCXXProto
+ ${PROTO_SRCS}
+ ${PROTO_HDRS}
+
+ LINK_LIBS
+ ${PROTOBUF_LIBRARIES}
+ )
+
+ # Build and include libprotobuf-mutator
+ include(ProtobufMutator)
+ include_directories(${ProtobufMutator_INCLUDE_DIRS})
+
+ # Build the protobuf->C++ translation library and driver.
+ add_clang_subdirectory(proto-to-cxx)
+
+ # Build the protobuf fuzzer
+ add_clang_executable(clang-proto-fuzzer ExampleClangProtoFuzzer.cpp)
+ target_link_libraries(clang-proto-fuzzer
+ ${ProtobufMutator_LIBRARIES}
+ clangCXXProto
+ clangHandleCXX
+ clangProtoToCXX
+ )
+ else()
+ # Hack to bypass LLVM's cmake sources check and allow multiple libraries and
+ # executables from this directory.
+ set(LLVM_OPTIONAL_SOURCES ClangFuzzer.cpp ExampleClangProtoFuzzer.cpp)
+ endif()
+
+ add_clang_subdirectory(handle-cxx)
+
+ add_clang_executable(clang-fuzzer
+ EXCLUDE_FROM_ALL
+ ClangFuzzer.cpp
)
- target_link_libraries(clang-proto-fuzzer
- ${ProtobufMutator_LIBRARIES}
- clangCXXProto
+ target_link_libraries(clang-fuzzer
clangHandleCXX
- clangProtoToCXX
)
endif()
-
-add_clang_subdirectory(handle-cxx)
-
-add_clang_executable(clang-fuzzer
- EXCLUDE_FROM_ALL
- ${DUMMY_MAIN}
- ClangFuzzer.cpp
- )
-
-target_link_libraries(clang-fuzzer
- clangHandleCXX
- )
Modified: cfe/trunk/tools/clang-fuzzer/ClangFuzzer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-fuzzer/ClangFuzzer.cpp?rev=315355&r1=315354&r2=315355&view=diff
==============================================================================
--- cfe/trunk/tools/clang-fuzzer/ClangFuzzer.cpp (original)
+++ cfe/trunk/tools/clang-fuzzer/ClangFuzzer.cpp Tue Oct 10 13:13:13 2017
@@ -17,8 +17,6 @@
using namespace clang_fuzzer;
-extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { return 0; }
-
extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
std::string s((const char *)data, size);
HandleCXX(s, {"-O2"});
Removed: cfe/trunk/tools/clang-fuzzer/DummyClangFuzzer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-fuzzer/DummyClangFuzzer.cpp?rev=315354&view=auto
==============================================================================
--- cfe/trunk/tools/clang-fuzzer/DummyClangFuzzer.cpp (original)
+++ cfe/trunk/tools/clang-fuzzer/DummyClangFuzzer.cpp (removed)
@@ -1,21 +0,0 @@
-//===-- DummyClangFuzzer.cpp - Entry point to sanity check fuzzers --------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Provides a main() to build without linking libFuzzer.
-//
-//===----------------------------------------------------------------------===//
-#include "llvm/FuzzMutate/FuzzerCLI.h"
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
-extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv);
-
-int main(int argc, char *argv[]) {
- return llvm::runFuzzerOnInputs(argc, argv, LLVMFuzzerTestOneInput,
- LLVMFuzzerInitialize);
-}
More information about the cfe-commits
mailing list