[sanitizer][test] Fix FastUnwindTest on LoongArch
authorYouling Tang <tangyouling@loongson.cn>
Thu, 10 Nov 2022 05:35:49 +0000 (13:35 +0800)
committerWeining Lu <luweining@loongson.cn>
Thu, 10 Nov 2022 05:35:52 +0000 (13:35 +0800)
Fixes the `FastUnwindTest` unit test for LoongArch.
This change is similar to RISCV D90574.

The following test cases pass after applying the patch:
```
$ ./runtimes/runtimes-bins/compiler-rt/lib/sanitizer_common/tests/Sanitizer-loongarch64-Test
...
[  FAILED  ] FastUnwindTest.Basic
[  FAILED  ] FastUnwindTest.FramePointerLoop
[  FAILED  ] FastUnwindTest.MisalignedFramePointer
[  FAILED  ] FastUnwindTest.FPBelowPrevFP
[  FAILED  ] FastUnwindTest.CloseToZeroFrame
```

Reviewed By: SixWeining, xen0n, MaskRay

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

compiler-rt/lib/sanitizer_common/tests/sanitizer_stacktrace_test.cpp

index e8d590a..a9dd066 100644 (file)
@@ -44,7 +44,7 @@ class FastUnwindTest : public ::testing::Test {
   uhwptr fake_bottom;
   BufferedStackTrace trace;
 
-#if defined(__riscv)
+#if defined(__loongarch__) || defined(__riscv)
   const uptr kFpOffset = 4;
   const uptr kBpOffset = 2;
 #else