diff options
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerInternal.h | 1 | ||||
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerLoop.cpp | 21 |
2 files changed, 2 insertions, 20 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h index 347228ebc42..3a3889723f7 100644 --- a/llvm/lib/Fuzzer/FuzzerInternal.h +++ b/llvm/lib/Fuzzer/FuzzerInternal.h @@ -110,7 +110,6 @@ private: // Stop tracing. void StopTraceRecording(); - void SetDeathCallback(); static void StaticDeathCallback(); void DumpCurrentUnit(const char *Prefix); void DeathCallback(); diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp index bed28d84e6a..4f1755055c0 100644 --- a/llvm/lib/Fuzzer/FuzzerLoop.cpp +++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp @@ -45,19 +45,6 @@ thread_local bool Fuzzer::IsMyThread; SharedMemoryRegion SMR; -static void MissingExternalApiFunction(const char *FnName) { - Printf("ERROR: %s is not defined. Exiting.\n" - "Did you use -fsanitize-coverage=... to build your code?\n", - FnName); - exit(1); -} - -#define CHECK_EXTERNAL_FUNCTION(fn) \ - do { \ - if (!(EF->fn)) \ - MissingExternalApiFunction(#fn); \ - } while (false) - // Only one Fuzzer per process. static Fuzzer *F; @@ -128,7 +115,8 @@ void Fuzzer::HandleMalloc(size_t Size) { Fuzzer::Fuzzer(UserCallback CB, InputCorpus &Corpus, MutationDispatcher &MD, FuzzingOptions Options) : CB(CB), Corpus(Corpus), MD(MD), Options(Options) { - SetDeathCallback(); + if (EF->__sanitizer_set_death_callback) + EF->__sanitizer_set_death_callback(StaticDeathCallback); InitializeTraceState(); assert(!F); F = this; @@ -157,11 +145,6 @@ void Fuzzer::AllocateCurrentUnitData() { CurrentUnitData = new uint8_t[MaxInputLen]; } -void Fuzzer::SetDeathCallback() { - CHECK_EXTERNAL_FUNCTION(__sanitizer_set_death_callback); - EF->__sanitizer_set_death_callback(StaticDeathCallback); -} - void Fuzzer::StaticDeathCallback() { assert(F); F->DeathCallback(); |