[PATCH] D138489: [tsan] Add tsan support for loongarch64

Lu Weining via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 22 05:35:38 PST 2022


SixWeining added a comment.

I haven't check the correctness of `tsan_rtl_loongarch64.S`.



================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1513
+
+  register int res __asm__("$a0");
+  register int __flags __asm__("$a0") = flags;
----------------
I'm not sure if this is necessary. Maybe `int res;` is enough?


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1543
+        "r"(__fn), "r"(__arg), "r"(nr_clone), "i"(__NR_exit)
+      : "memory");
+  return res;
----------------
Shall we list $t0-$t8 here? Ref D137396.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_linux.h:80
 void internal_sigdelset(__sanitizer_sigset_t *set, int signum);
-#if defined(__x86_64__) || defined(__mips__) || defined(__aarch64__) || \
-    defined(__powerpc64__) || defined(__s390__) || defined(__i386__) || \
-    defined(__arm__) || SANITIZER_RISCV64
+#    if defined(__x86_64__) || defined(__mips__) || defined(__aarch64__) || \
+        defined(__powerpc64__) || defined(__s390__) || defined(__i386__) || \
----------------
May be it's better to keep original indention. Otherwise the paired `#endif` doesn't look good.


================
Comment at: compiler-rt/test/sanitizer_common/print_address.h:12
+    defined(__s390x__) || (defined(__riscv) && __riscv_xlen == 64) ||          \
+    defined(__loongarch__)
     // On FreeBSD, the %p conversion specifier works as 0x%x and thus does not
----------------
Should be __loongarch64?


================
Comment at: compiler-rt/test/tsan/mmap_large.cpp:20
   const size_t kLog2Size = 39;
-#elif defined(__mips64) || defined(__aarch64__)
+#elif defined(__mips64) || defined(__aarch64__) || defined(__loongarch__)
   const size_t kLog2Size = 32;
----------------
Should be __loongarch64?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138489/new/

https://reviews.llvm.org/D138489



More information about the cfe-commits mailing list