summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp
diff options
context:
space:
mode:
authorJonathan Metzman <metzman@chromium.org>2018-09-20 23:24:48 +0000
committerJonathan Metzman <metzman@chromium.org>2018-09-20 23:24:48 +0000
commit0744d3c5a1dd6407f6f939f3893fa4165918cb42 (patch)
treefe526f3a2d2167d7ebcf0d3d1c77b45fa039b3d8 /compiler-rt/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp
parentfec72d2a915fd7573638893d9e0f2f664628d62e (diff)
downloadbcm5719-llvm-0744d3c5a1dd6407f6f939f3893fa4165918cb42.tar.gz
bcm5719-llvm-0744d3c5a1dd6407f6f939f3893fa4165918cb42.zip
[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 llvm-svn: 342698
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp')
-rw-r--r--compiler-rt/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp62
1 files changed, 0 insertions, 62 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp b/compiler-rt/lib/fuzzer/FuzzerExtFunctionsDlsymWin.cpp
deleted file mode 100644
index e09da3fdeee..00000000000
--- a/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 <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
OpenPOWER on IntegriCloud