[PATCH] D41022: Register NetBSD/x86_64 in MemorySanitizer.cpp

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 10:10:16 PST 2017


krytarowski created this revision.
krytarowski added a project: Sanitizers.

Reuse the Linux new mapping as it is.

Sponsored by <The NetBSD Foundation>


Repository:
  rL LLVM

https://reviews.llvm.org/D41022

Files:
  lib/Transforms/Instrumentation/MemorySanitizer.cpp


Index: lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -320,6 +320,14 @@
   0x380000000000,  // OriginBase
 };
 
+// x86_64 NetBSD
+static const MemoryMapParams NetBSD_X86_64_MemoryMapParams = {
+  0,               // AndMask
+  0x500000000000,  // XorMask
+  0,               // ShadowBase
+  0x100000000000,  // OriginBase
+};
+
 static const PlatformMemoryMapParams Linux_X86_MemoryMapParams = {
   &Linux_I386_MemoryMapParams,
   &Linux_X86_64_MemoryMapParams,
@@ -345,6 +353,11 @@
   &FreeBSD_X86_64_MemoryMapParams,
 };
 
+static const PlatformMemoryMapParams NetBSD_X86_MemoryMapParams = {
+  nullptr,
+  &NetBSD_X86_64_MemoryMapParams,
+};
+
 namespace {
 
 /// \brief An instrumentation pass implementing detection of uninitialized
@@ -577,6 +590,15 @@
           report_fatal_error("unsupported architecture");
       }
       break;
+    case Triple::NetBSD:
+      switch (TargetTriple.getArch()) {
+        case Triple::x86_64:
+          MapParams = NetBSD_X86_MemoryMapParams.bits64;
+          break;
+        default:
+          report_fatal_error("unsupported architecture");
+      }
+      break;
     case Triple::Linux:
       switch (TargetTriple.getArch()) {
         case Triple::x86_64:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41022.126176.patch
Type: text/x-patch
Size: 1397 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171208/45533723/attachment.bin>


More information about the llvm-commits mailing list