[PATCH] D45125: Xray OpenBSD support
Dean Michael Berris via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 4 06:07:22 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329189: [XRay][compiler-rt] Build XRay runtime for OpenBSD (authored by dberris, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D45125?vs=140549&id=140953#toc
Repository:
rL LLVM
https://reviews.llvm.org/D45125
Files:
compiler-rt/trunk/cmake/config-ix.cmake
compiler-rt/trunk/lib/xray/xray_x86_64.cc
Index: compiler-rt/trunk/cmake/config-ix.cmake
===================================================================
--- compiler-rt/trunk/cmake/config-ix.cmake
+++ compiler-rt/trunk/cmake/config-ix.cmake
@@ -600,7 +600,7 @@
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND XRAY_SUPPORTED_ARCH AND
- OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD")
+ OS_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|OpenBSD")
set(COMPILER_RT_HAS_XRAY TRUE)
else()
set(COMPILER_RT_HAS_XRAY FALSE)
Index: compiler-rt/trunk/lib/xray/xray_x86_64.cc
===================================================================
--- compiler-rt/trunk/lib/xray/xray_x86_64.cc
+++ compiler-rt/trunk/lib/xray/xray_x86_64.cc
@@ -3,8 +3,12 @@
#include "xray_defs.h"
#include "xray_interface_internal.h"
-#if SANITIZER_FREEBSD || SANITIZER_NETBSD
+#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
#include <sys/types.h>
+#if SANITIZER_OPENBSD
+#include <sys/time.h>
+#include <machine/cpu.h>
+#endif
#include <sys/sysctl.h>
#endif
@@ -77,13 +81,18 @@
}
return TSCFrequency == -1 ? 0 : static_cast<uint64_t>(TSCFrequency);
}
-#elif SANITIZER_FREEBSD || SANITIZER_NETBSD
+#elif SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
long long TSCFrequency = -1;
size_t tscfreqsz = sizeof(TSCFrequency);
+#if SANITIZER_OPENBSD
+ int Mib[2] = { CTL_MACHDEP, CPU_TSCFREQ };
+ if (sysctl(Mib, 2, &TSCFrequency, &tscfreqsz, NULL, 0) != -1) {
+#else
if (sysctlbyname("machdep.tsc_freq", &TSCFrequency, &tscfreqsz,
NULL, 0) != -1) {
+#endif
return static_cast<uint64_t>(TSCFrequency);
} else {
Report("Unable to determine CPU frequency for TSC accounting.\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45125.140953.patch
Type: text/x-patch
Size: 1762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180404/2b2968da/attachment.bin>
More information about the llvm-commits
mailing list