summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Pividori <mpividori@google.com>2017-02-08 00:02:12 +0000
committerMarcos Pividori <mpividori@google.com>2017-02-08 00:02:12 +0000
commitc8cee28a5b0fb55b1c4c62bdf8f5bd1aea62f2e8 (patch)
tree3bc6eeaa9152cf2690971659713fd34fa45f4a8c
parentec892139bda15b4e86d953d8fd3e70ffca83902d (diff)
downloadbcm5719-llvm-c8cee28a5b0fb55b1c4c62bdf8f5bd1aea62f2e8.tar.gz
bcm5719-llvm-c8cee28a5b0fb55b1c4c62bdf8f5bd1aea62f2e8.zip
[libFuzzer] Temporarily fix Shmem for Windows.
In this diff, I add stubs for shared memory on Windows. Now we can compile and use libFuzzer without support for shared memory. Differential Revision: https://reviews.llvm.org/D29544 llvm-svn: 294376
-rw-r--r--llvm/lib/Fuzzer/CMakeLists.txt1
-rw-r--r--llvm/lib/Fuzzer/FuzzerShmemWindows.cpp64
2 files changed, 65 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/CMakeLists.txt b/llvm/lib/Fuzzer/CMakeLists.txt
index 7e41ef89e67..4b947d87e6d 100644
--- a/llvm/lib/Fuzzer/CMakeLists.txt
+++ b/llvm/lib/Fuzzer/CMakeLists.txt
@@ -22,6 +22,7 @@ if( LLVM_USE_SANITIZE_COVERAGE )
FuzzerMutate.cpp
FuzzerSHA1.cpp
FuzzerShmemPosix.cpp
+ FuzzerShmemWindows.cpp
FuzzerTracePC.cpp
FuzzerTraceState.cpp
FuzzerUtil.cpp
diff --git a/llvm/lib/Fuzzer/FuzzerShmemWindows.cpp b/llvm/lib/Fuzzer/FuzzerShmemWindows.cpp
new file mode 100644
index 00000000000..6325b4b8e5b
--- /dev/null
+++ b/llvm/lib/Fuzzer/FuzzerShmemWindows.cpp
@@ -0,0 +1,64 @@
+//===- FuzzerShmemWindows.cpp - Posix shared memory -------------*- C++ -* ===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// SharedMemoryRegion
+//===----------------------------------------------------------------------===//
+#include "FuzzerDefs.h"
+#if LIBFUZZER_WINDOWS
+
+#include "FuzzerIO.h"
+#include "FuzzerShmem.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+
+namespace fuzzer {
+
+std::string SharedMemoryRegion::Path(const char *Name) {
+ return DirPlusFile(TmpDir(), Name);
+}
+
+std::string SharedMemoryRegion::SemName(const char *Name, int Idx) {
+ std::string Res(Name);
+ return Res + (char)('0' + Idx);
+}
+
+bool SharedMemoryRegion::Map(int fd) {
+ assert(0 && "UNIMPLEMENTED");
+ return false;
+}
+
+bool SharedMemoryRegion::Create(const char *Name) {
+ assert(0 && "UNIMPLEMENTED");
+ return false;
+}
+
+bool SharedMemoryRegion::Open(const char *Name) {
+ assert(0 && "UNIMPLEMENTED");
+ return false;
+}
+
+bool SharedMemoryRegion::Destroy(const char *Name) {
+ assert(0 && "UNIMPLEMENTED");
+ return false;
+}
+
+void SharedMemoryRegion::Post(int Idx) {
+ assert(0 && "UNIMPLEMENTED");
+}
+
+void SharedMemoryRegion::Wait(int Idx) {
+ Semaphore[1] = nullptr;
+ assert(0 && "UNIMPLEMENTED");
+}
+
+} // namespace fuzzer
+
+#endif // LIBFUZZER_WINDOWS
OpenPOWER on IntegriCloud