Add initial XRay support for NetBSD
authorKamil Rytarowski <n54@gmx.com>
Fri, 16 Feb 2018 14:45:20 +0000 (14:45 +0000)
committerKamil Rytarowski <n54@gmx.com>
Fri, 16 Feb 2018 14:45:20 +0000 (14:45 +0000)
Summary:
Reuse the existing FreeBSD code as it is.

Sponsored by <The NetBSD Foundation>

Reviewers: dberris, rnk, vitalybuka

Reviewed By: dberris

Subscribers: mclow.lists, emaste, mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D43370

llvm-svn: 325345

compiler-rt/cmake/config-ix.cmake
compiler-rt/lib/xray/xray_x86_64.cc
compiler-rt/test/xray/lit.cfg

index ac2465b8b63f3f71159241be74090b0d6b98aba2..9f24b9d50b37ad78f29b643bef176b44b50c6f99 100644 (file)
@@ -597,7 +597,7 @@ else()
 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)
index 50a697a2c306175cbc489557c6293aa6a9d4f09d..dfd663152b2bb74c509b96f9159954c8808d30ff 100644 (file)
@@ -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 @@ uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
   }
   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 a84aa76f13fd7e217da70793f865af1b92b577f9..ae2689c9a9775c372af4890238f29c0ce7d5d5e7 100644 (file)
@@ -45,7 +45,7 @@ config.substitutions.append(
 # 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: