diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index ac2465b8b63f..9f24b9d50b37 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -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) diff --git a/compiler-rt/lib/xray/xray_x86_64.cc b/compiler-rt/lib/xray/xray_x86_64.cc index 50a697a2c306..dfd663152b2b 100644 --- a/compiler-rt/lib/xray/xray_x86_64.cc +++ b/compiler-rt/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 #include #endif @@ -76,7 +77,7 @@ uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT { } return TSCFrequency == -1 ? 0 : static_cast(TSCFrequency); } -#elif SANITIZER_FREEBSD +#elif SANITIZER_FREEBSD || SANITIZER_NETBSD uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT { long long TSCFrequency = -1; size_t tscfreqsz = sizeof(TSCFrequency); diff --git a/compiler-rt/test/xray/lit.cfg b/compiler-rt/test/xray/lit.cfg index a84aa76f13fd..ae2689c9a977 100644 --- a/compiler-rt/test/xray/lit.cfg +++ b/compiler-rt/test/xray/lit.cfg @@ -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: