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

Youling Tang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 22 17:28:34 PST 2022


tangyouling added a comment.





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

Referring to riscv64/aarch64, the existing definition is probably appropriate.
The return value `res` is stored directly in $a0, which may reduce the need to `move` the `res` value to $a0.


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

I will add the missing $t0-$t8.


================
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__) || \
----------------
xry111 wrote:
> SixWeining wrote:
> > May be it's better to keep original indention. Otherwise the paired `#endif` doesn't look good.
> The problem is `git clang-format` sometimes insist you to change the indentation...
> The problem is `git clang-format` sometimes insist you to change the indentation...

Yeah.


================
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
----------------
xry111 wrote:
> SixWeining wrote:
> > Should be __loongarch64?
> `__loongarch64` is deprecated, use `__loongarch_lp64` instead.
> `__loongarch64` is deprecated, use `__loongarch_lp64` instead.

Okay, use __loongarch_lp64 instead.


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