[PATCH] D43370: Add XRay support for NetBSD

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 21:34:34 PST 2018


krytarowski created this revision.
krytarowski added reviewers: dberris, rnk, vitalybuka.
krytarowski added a project: Sanitizers.
Herald added subscribers: mgorny, emaste.

Reuse the existing FreeBSD code as it is.

Sponsored by <The NetBSD Foundation>


Repository:
  rL LLVM

https://reviews.llvm.org/D43370

Files:
  cmake/config-ix.cmake
  lib/xray/xray_x86_64.cc
  test/xray/lit.cfg


Index: test/xray/lit.cfg
===================================================================
--- test/xray/lit.cfg
+++ test/xray/lit.cfg
@@ -45,7 +45,7 @@
 # Default test suffixes.
 config.suffixes = ['.c', '.cc', '.cpp']
 
-if config.host_os not in ['FreeBSD', 'Linux']:
+if config.host_os not in ['FreeBSD', 'Linux', 'NetBSD']:
   config.unsupported = True
 elif '64' not in config.host_arch:
   if 'arm' in config.host_arch:
Index: lib/xray/xray_x86_64.cc
===================================================================
--- lib/xray/xray_x86_64.cc
+++ lib/xray/xray_x86_64.cc
@@ -3,7 +3,8 @@
 #include "xray_defs.h"
 #include "xray_interface_internal.h"
 
-#if SANITIZER_FREEBSD
+#if SANITIZER_FREEBSD || SANITIZER_NETBSD
+#include <sys/types.h>
 #include <sys/sysctl.h>
 #endif
 
@@ -76,7 +77,7 @@
   }
   return TSCFrequency == -1 ? 0 : static_cast<uint64_t>(TSCFrequency);
 }
-#elif SANITIZER_FREEBSD
+#elif SANITIZER_FREEBSD || SANITIZER_NETBSD
 uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
     long long TSCFrequency = -1;
     size_t tscfreqsz = sizeof(TSCFrequency);
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -597,7 +597,7 @@
 endif()
 
 if (COMPILER_RT_HAS_SANITIZER_COMMON AND XRAY_SUPPORTED_ARCH AND
-    OS_NAME MATCHES "Darwin|Linux|FreeBSD")
+    OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD")
   set(COMPILER_RT_HAS_XRAY TRUE)
 else()
   set(COMPILER_RT_HAS_XRAY FALSE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43370.134556.patch
Type: text/x-patch
Size: 1508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180216/2e317161/attachment.bin>


More information about the llvm-commits mailing list