[compiler-rt] [tsan][riscv] add Go race detector support for RISC-V sv39 VMA (PR #154701)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 21 11:21:45 PDT 2025


================
@@ -63,6 +63,13 @@ int main(void) {
   __tsan_init(&thr0, &proc0, symbolize_cb);
   current_proc = proc0;
 
+#if defined(__riscv) && (__riscv_xlen == 64) && defined(__linux__)
+  // Use correct go_heap for riscv64 sv39.
+  if (65 - __builtin_clzl((unsigned long)__builtin_frame_address(0)) == 39) {
----------------
fmayer wrote:

I don't understand this. How do we know how many bits are in `__builtin_frame_address`? Is this making assumptions on where the stack is placed by the kernel? Is this guaranteed?

https://github.com/llvm/llvm-project/pull/154701


More information about the llvm-commits mailing list