[compiler-rt] r370209 - [XRay] Fixing one test case for FreeBSD

David Carlier via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 07:18:05 PDT 2019


Author: devnexen
Date: Wed Aug 28 07:18:05 2019
New Revision: 370209

URL: http://llvm.org/viewvc/llvm-project?rev=370209&view=rev
Log:
[XRay] Fixing one test case for FreeBSD

Reviewers: dberris

Reviewed By: dberris

Differential Revision: https://reviews.llvm.org/D66867

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

Modified: compiler-rt/trunk/test/xray/TestCases/Posix/fork_basic_logging.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/xray/TestCases/Posix/fork_basic_logging.cpp?rev=370209&r1=370208&r2=370209&view=diff
==============================================================================
--- compiler-rt/trunk/test/xray/TestCases/Posix/fork_basic_logging.cpp (original)
+++ compiler-rt/trunk/test/xray/TestCases/Posix/fork_basic_logging.cpp Wed Aug 28 07:18:05 2019
@@ -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;
 }
 




More information about the llvm-commits mailing list