From 9b13b8c3380c44602dab34a8fbae0edf2961ec3a Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Fri, 6 Feb 2015 19:52:07 +0000 Subject: [PATCH] [fuzzer] move default sanitizer options to a separate file git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228429 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Fuzzer/CMakeLists.txt | 1 + lib/Fuzzer/FuzzerMain.cpp | 7 ------- lib/Fuzzer/FuzzerSanitizerOptions.cpp | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 lib/Fuzzer/FuzzerSanitizerOptions.cpp diff --git a/lib/Fuzzer/CMakeLists.txt b/lib/Fuzzer/CMakeLists.txt index a68df7f0feb..02370c966af 100644 --- a/lib/Fuzzer/CMakeLists.txt +++ b/lib/Fuzzer/CMakeLists.txt @@ -6,6 +6,7 @@ if( LLVM_USE_SANITIZE_COVERAGE ) FuzzerIO.cpp FuzzerLoop.cpp FuzzerMutate.cpp + FuzzerSanitizerOptions.cpp FuzzerUtil.cpp ) add_library(LLVMFuzzer STATIC diff --git a/lib/Fuzzer/FuzzerMain.cpp b/lib/Fuzzer/FuzzerMain.cpp index 294b9ccc429..15a325d3159 100644 --- a/lib/Fuzzer/FuzzerMain.cpp +++ b/lib/Fuzzer/FuzzerMain.cpp @@ -18,13 +18,6 @@ #include #include -// ASAN options: -// * don't dump the coverage to disk. -// * enable coverage by default. -extern "C" const char *__asan_default_options() { - return "coverage_pcs=0:coverage=1"; -} - // Program arguments. struct FlagDescription { const char *Name; diff --git a/lib/Fuzzer/FuzzerSanitizerOptions.cpp b/lib/Fuzzer/FuzzerSanitizerOptions.cpp new file mode 100644 index 00000000000..1c58f3a0694 --- /dev/null +++ b/lib/Fuzzer/FuzzerSanitizerOptions.cpp @@ -0,0 +1,18 @@ +//===- FuzzerSanitizerOptions.cpp - default flags for sanitizers ----------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// Set default options for sanitizers while running the fuzzer. +// Options reside in a separate file, so if we don't want to set the default +// options we simply do not link this file in. +// ASAN options: +// * don't dump the coverage to disk. +// * enable coverage by default. +//===----------------------------------------------------------------------===// +extern "C" const char *__asan_default_options() { + return "coverage_pcs=0:coverage=1"; +} -- 2.34.1