Skip to content

Commit

Permalink
Add initial XRay support for NetBSD
Browse files Browse the repository at this point in the history
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
  • Loading branch information
krytarowski committed Feb 16, 2018
1 parent c5105f9 commit bab5252
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler-rt/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions compiler-rt/lib/xray/xray_x86_64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/xray/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bab5252

Please sign in to comment.