[PATCH] D51399: [Xray] Darwin improving slightly the support
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 28 18:57:47 PDT 2018
devnexen created this revision.
devnexen added a reviewer: dberris.
devnexen created this object with visibility "All Users".
Herald added subscribers: Sanitizers, llvm-commits, krytarowski, mgorny, kubamracek.
- using sysctl to get the tic frequency data.
- still linkage issue for X-ray_init not resolved.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D51399
Files:
lib/asan/CMakeLists.txt
lib/xray/CMakeLists.txt
lib/xray/xray_x86_64.cc
Index: lib/xray/xray_x86_64.cc
===================================================================
--- lib/xray/xray_x86_64.cc
+++ lib/xray/xray_x86_64.cc
@@ -3,7 +3,7 @@
#include "xray_defs.h"
#include "xray_interface_internal.h"
-#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
+#if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD || SANITIZER_MAC
#include <sys/types.h>
#if SANITIZER_OPENBSD
#include <sys/time.h>
@@ -81,13 +81,16 @@
}
return TSCFrequency == -1 ? 0 : static_cast<uint64_t>(TSCFrequency);
}
-#elif SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD
+#elif SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_OPENBSD || SANITIZER_MAC
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) {
+#elif SANITIZER_MAC
+ if (sysctlbyname("machdep.tsc.frequency", &TSCFrequency, &tscfreqz,
+ NULL, 0) != -1 ) {
#else
if (sysctlbyname("machdep.tsc_freq", &TSCFrequency, &tscfreqsz,
Index: lib/xray/CMakeLists.txt
===================================================================
--- lib/xray/CMakeLists.txt
+++ lib/xray/CMakeLists.txt
@@ -147,7 +147,7 @@
add_compiler_rt_object_libraries(RTXray
OS ${XRAY_SUPPORTED_OS}
ARCHS ${XRAY_SUPPORTED_ARCH}
- SOURCES ${x86_64_SOURCES}
+ SOURCES ${XRAY_SOURCES} ${x86_64_SOURCES}
ADDITIONAL_HEADERS ${XRAY_IMPL_HEADERS}
CFLAGS ${XRAY_CFLAGS}
DEFS ${XRAY_COMMON_DEFINITIONS}
Index: lib/asan/CMakeLists.txt
===================================================================
--- lib/asan/CMakeLists.txt
+++ lib/asan/CMakeLists.txt
@@ -138,6 +138,7 @@
add_weak_symbols("lsan" WEAK_SYMBOL_LINK_FLAGS)
add_weak_symbols("ubsan" WEAK_SYMBOL_LINK_FLAGS)
add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
+ add_weak_symbols("xray" WEAK_SYMBOL_LINK_FLAGS)
add_compiler_rt_runtime(clang_rt.asan
SHARED
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51399.163005.patch
Type: text/x-patch
Size: 2086 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180829/24505c69/attachment.bin>
More information about the llvm-commits
mailing list