[PATCH] D66867: [XRay] Fixing one test case for FreeBSD

David CARLIER via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 03:26:26 PDT 2019


devnexen created this revision.
devnexen added a reviewer: dberris.
devnexen created this object with visibility "All Users".
Herald added subscribers: llvm-commits, Sanitizers, krytarowski.
Herald added projects: LLVM, Sanitizers.
devnexen added a comment.

Might need to backport it to 9.0 before Friday :)


Porting the Linux syscall.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D66867

Files:
  compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp


Index: compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp
===================================================================
--- compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp
+++ compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp
@@ -18,14 +18,24 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <stdint.h>
+#if defined(__linux__)
 #include <sys/syscall.h>
+#elif defined(__FreeBSD__)
+#include <sys/thr.h>
+#endif
 
 //modified from sanitizer
 
 static uintptr_t syscall_gettid() {
   uint64_t retval;
+#ifdef __linux__
   asm volatile("syscall" : "=a"(retval) : "a"(__NR_gettid) : "rcx", "r11",
                "memory", "cc");
+#else
+  long t;
+  thr_self(&t);
+  retval = static_cast<uint64_t>(t);
+#endif
   return retval;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66867.217597.patch
Type: text/x-patch
Size: 775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190828/a938aab6/attachment.bin>


More information about the llvm-commits mailing list