[compiler-rt] r342698 - [fuzzer] Replace FuzzerExtFunctionsDlsymWin.cpp with FuzzerExtFunctionsWeakAlias.cpp
Jonathan Metzman via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 20 16:24:49 PDT 2018
Author: metzman
Date: Thu Sep 20 16:24:48 2018
New Revision: 342698
URL: http://llvm.org/viewvc/llvm-project?rev=342698&view=rev
Log:
[fuzzer] Replace FuzzerExtFunctionsDlsymWin.cpp with FuzzerExtFunctionsWeakAlias.cpp
Summary:
Replace FuzzerExtFunctionsDlsymWin.cpp with FuzzerExtFunctionsWeakAlias.cpp
to get externally defined functions (eg: LLVMFuzzerInitialize,
LLVMFuzzerCustomMutator, etc) working again.
Also enable tests that depended on these functions (on windows)
Reviewers: rnk, morehouse
Reviewed By: rnk, morehouse
Subscribers: rnk, morehouse, mgorny
Differential Revision: https://reviews.llvm.org/D51700
Removed:
compiler-rt/trunk/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp
Modified:
compiler-rt/trunk/lib/fuzzer/CMakeLists.txt
compiler-rt/trunk/test/fuzzer/bogus-initialize.test
compiler-rt/trunk/test/fuzzer/fuzzer-customcrossover.test
compiler-rt/trunk/test/fuzzer/fuzzer-custommutator.test
compiler-rt/trunk/test/fuzzer/fuzzer-flags.test
compiler-rt/trunk/test/fuzzer/initialize.test
compiler-rt/trunk/test/fuzzer/standalone.test
Modified: compiler-rt/trunk/lib/fuzzer/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/CMakeLists.txt?rev=342698&r1=342697&r2=342698&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/fuzzer/CMakeLists.txt Thu Sep 20 16:24:48 2018
@@ -3,7 +3,7 @@ set(LIBFUZZER_SOURCES
FuzzerDataFlowTrace.cpp
FuzzerDriver.cpp
FuzzerExtFunctionsDlsym.cpp
- FuzzerExtFunctionsDlsymWin.cpp
+ FuzzerExtFunctionsWeakAlias.cpp
FuzzerExtFunctionsWeak.cpp
FuzzerExtraCounters.cpp
FuzzerIO.cpp
Removed: compiler-rt/trunk/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp?rev=342697&view=auto
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp (removed)
@@ -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 <windows.h>
-
-// This must be included after Windows.h.
-#include <psapi.h>
-
-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
Modified: compiler-rt/trunk/test/fuzzer/bogus-initialize.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/bogus-initialize.test?rev=342698&r1=342697&r2=342698&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/bogus-initialize.test (original)
+++ compiler-rt/trunk/test/fuzzer/bogus-initialize.test Thu Sep 20 16:24:48 2018
@@ -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
Modified: compiler-rt/trunk/test/fuzzer/fuzzer-customcrossover.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/fuzzer-customcrossover.test?rev=342698&r1=342697&r2=342698&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/fuzzer-customcrossover.test (original)
+++ compiler-rt/trunk/test/fuzzer/fuzzer-customcrossover.test Thu Sep 20 16:24:48 2018
@@ -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
Modified: compiler-rt/trunk/test/fuzzer/fuzzer-custommutator.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/fuzzer-custommutator.test?rev=342698&r1=342697&r2=342698&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/fuzzer-custommutator.test (original)
+++ compiler-rt/trunk/test/fuzzer/fuzzer-custommutator.test Thu Sep 20 16:24:48 2018
@@ -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
Modified: compiler-rt/trunk/test/fuzzer/fuzzer-flags.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/fuzzer-flags.test?rev=342698&r1=342697&r2=342698&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/fuzzer-flags.test (original)
+++ compiler-rt/trunk/test/fuzzer/fuzzer-flags.test Thu Sep 20 16:24:48 2018
@@ -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
Modified: compiler-rt/trunk/test/fuzzer/initialize.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/initialize.test?rev=342698&r1=342697&r2=342698&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/initialize.test (original)
+++ compiler-rt/trunk/test/fuzzer/initialize.test Thu Sep 20 16:24:48 2018
@@ -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
Modified: compiler-rt/trunk/test/fuzzer/standalone.test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/fuzzer/standalone.test?rev=342698&r1=342697&r2=342698&view=diff
==============================================================================
--- compiler-rt/trunk/test/fuzzer/standalone.test (original)
+++ compiler-rt/trunk/test/fuzzer/standalone.test Thu Sep 20 16:24:48 2018
@@ -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
More information about the llvm-commits
mailing list