Index: compiler-rt/lib/fuzzer/CMakeLists.txt =================================================================== --- compiler-rt/lib/fuzzer/CMakeLists.txt +++ compiler-rt/lib/fuzzer/CMakeLists.txt @@ -3,7 +3,7 @@ FuzzerDataFlowTrace.cpp FuzzerDriver.cpp FuzzerExtFunctionsDlsym.cpp - FuzzerExtFunctionsDlsymWin.cpp + FuzzerExtFunctionsWeakAlias.cpp FuzzerExtFunctionsWeak.cpp FuzzerExtraCounters.cpp FuzzerIO.cpp Index: compiler-rt/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp =================================================================== --- compiler-rt/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===- FuzzerExtFunctionsDlsymWin.cpp - Interface to external functions ---===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// Implementation using dynamic loading for Windows. -//===----------------------------------------------------------------------===// -#include "FuzzerDefs.h" -#if LIBFUZZER_WINDOWS - -#include "FuzzerExtFunctions.h" -#include "FuzzerIO.h" -#include - -// This must be included after Windows.h. -#include - -namespace fuzzer { - -ExternalFunctions::ExternalFunctions() { - HMODULE Modules[1024]; - DWORD BytesNeeded; - HANDLE CurrentProcess = GetCurrentProcess(); - - if (!EnumProcessModules(CurrentProcess, Modules, sizeof(Modules), - &BytesNeeded)) { - Printf("EnumProcessModules failed (error: %d).\n", GetLastError()); - exit(1); - } - - if (sizeof(Modules) < BytesNeeded) { - Printf("Error: the array is not big enough to hold all loaded modules.\n"); - exit(1); - } - - for (size_t i = 0; i < (BytesNeeded / sizeof(HMODULE)); i++) - { - FARPROC Fn; -#define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \ - if (this->NAME == nullptr) { \ - Fn = GetProcAddress(Modules[i], #NAME); \ - if (Fn == nullptr) \ - Fn = GetProcAddress(Modules[i], #NAME "__dll"); \ - this->NAME = (decltype(ExternalFunctions::NAME)) Fn; \ - } -#include "FuzzerExtFunctions.def" -#undef EXT_FUNC - } - -#define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \ - if (this->NAME == nullptr && WARN) \ - Printf("WARNING: Failed to find function \"%s\".\n", #NAME); -#include "FuzzerExtFunctions.def" -#undef EXT_FUNC -} - -} // namespace fuzzer - -#endif // LIBFUZZER_WINDOWS Index: compiler-rt/test/fuzzer/bogus-initialize.test =================================================================== --- compiler-rt/test/fuzzer/bogus-initialize.test +++ compiler-rt/test/fuzzer/bogus-initialize.test @@ -1,5 +1,3 @@ -# FIXME: Disabled on Windows since LLVMFuzzerInitialize does not yet work. -UNSUPPORTED: windows RUN: %cpp_compiler %S/BogusInitializeTest.cpp -o %t-BogusInitializeTest RUN: not %run %t-BogusInitializeTest 2>&1 | FileCheck %s --check-prefix=BOGUS_INITIALIZE Index: compiler-rt/test/fuzzer/fuzzer-customcrossover.test =================================================================== --- compiler-rt/test/fuzzer/fuzzer-customcrossover.test +++ compiler-rt/test/fuzzer/fuzzer-customcrossover.test @@ -1,5 +1,3 @@ -# FIXME: Disabled on Windows since LLVMFuzzerCustomCrossOver does not yet work. -UNSUPPORTED: windows RUN: %cpp_compiler %S/CustomCrossOverTest.cpp -o %t-CustomCrossOverTest RUN: not %run %t-CustomCrossOverTest -seed=1 -runs=1000000 2>&1 | FileCheck %s --check-prefix=CHECK_CO Index: compiler-rt/test/fuzzer/fuzzer-custommutator.test =================================================================== --- compiler-rt/test/fuzzer/fuzzer-custommutator.test +++ compiler-rt/test/fuzzer/fuzzer-custommutator.test @@ -1,5 +1,3 @@ -# FIXME: Disabled on Windows since LLVMFuzzerCustomMutator does not yet work. -UNSUPPORTED: windows RUN: %cpp_compiler %S/CustomMutatorTest.cpp -o %t-CustomMutatorTest RUN: not %run %t-CustomMutatorTest 2>&1 | FileCheck %s --check-prefix=LLVMFuzzerCustomMutator LLVMFuzzerCustomMutator: In LLVMFuzzerCustomMutator Index: compiler-rt/test/fuzzer/fuzzer-flags.test =================================================================== --- compiler-rt/test/fuzzer/fuzzer-flags.test +++ compiler-rt/test/fuzzer/fuzzer-flags.test @@ -1,6 +1,3 @@ -# FIXME: Disabled on Windows since LLVMFuzzerInitialize does not yet work. -UNSUPPORTED: windows -RUN: %cpp_compiler %S/FlagsTest.cpp -o %t-FlagsTest RUN: %run %t-FlagsTest -runs=10 -foo_bar=1 2>&1 | FileCheck %s --check-prefix=FOO_BAR FOO_BAR: WARNING: unrecognized flag '-foo_bar=1'; use -help=1 to list all flags FOO_BAR: BINGO Index: compiler-rt/test/fuzzer/initialize.test =================================================================== --- compiler-rt/test/fuzzer/initialize.test +++ compiler-rt/test/fuzzer/initialize.test @@ -1,5 +1,3 @@ -# FIXME: Disabled on Windows since LLVMFuzzerInitialize does not yet work. -UNSUPPORTED: windows CHECK: BINGO RUN: %cpp_compiler %S/InitializeTest.cpp -o %t-InitializeTest RUN: not %run %t-InitializeTest -use_value_profile=1 2>&1 | FileCheck %s Index: compiler-rt/test/fuzzer/standalone.test =================================================================== --- compiler-rt/test/fuzzer/standalone.test +++ compiler-rt/test/fuzzer/standalone.test @@ -1,5 +1,3 @@ -# FIXME: Disabled on Windows because memmem is a GNU extension. -UNSUPPORTED: windows RUN: %no_fuzzer_c_compiler %libfuzzer_src/standalone/StandaloneFuzzTargetMain.c -c -o %t_1.o RUN: %no_fuzzer_cpp_compiler %S/InitializeTest.cpp -c -o %t_2.o