[compiler-rt] 867ff7c - [asan][test] Fix build errors in loongarch64

Weining Lu via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 05:22:56 PDT 2022


Author: Youling Tang
Date: 2022-11-01T20:21:56+08:00
New Revision: 867ff7c994b4b891c8d92f0dff6bac70f9d9dcf4

URL: https://github.com/llvm/llvm-project/commit/867ff7c994b4b891c8d92f0dff6bac70f9d9dcf4
DIFF: https://github.com/llvm/llvm-project/commit/867ff7c994b4b891c8d92f0dff6bac70f9d9dcf4.diff

LOG: [asan][test] Fix build errors in loongarch64

- Add get_bits_for_arch for loongarch64 detection, fix the following error,
```
$ make check-asan
-- sanitizer_common tests on "Linux" will run against "asan"
CMake Error at test/asan/CMakeLists.txt:22 (message):
  Unknown target architecture: loongarch64
Call Stack (most recent call first):
  test/asan/CMakeLists.txt:49 (get_bits_for_arch)
```

- Do not use __builtin_longjmp, fix the following error,
```
llvm-project/compiler-rt/lib/asan/tests/asan_test.cpp:635:3: error: __builtin_longjmp is not supported for the current target
  __builtin_longjmp((void**)buf, 1);
```

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

Added: 
    

Modified: 
    compiler-rt/lib/asan/tests/asan_test.cpp
    compiler-rt/test/asan/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/tests/asan_test.cpp b/compiler-rt/lib/asan/tests/asan_test.cpp
index 7aa0de5aa0a10..40b335d134653 100644
--- a/compiler-rt/lib/asan/tests/asan_test.cpp
+++ b/compiler-rt/lib/asan/tests/asan_test.cpp
@@ -623,7 +623,7 @@ NOINLINE void SigLongJmpFunc1(sigjmp_buf buf) {
 
 #if !defined(__ANDROID__) && !defined(__arm__) && !defined(__aarch64__) && \
     !defined(__mips__) && !defined(__mips64) && !defined(__s390__) &&      \
-    !defined(__riscv)
+    !defined(__riscv) && !defined(__loongarch__)
 NOINLINE void BuiltinLongJmpFunc1(jmp_buf buf) {
   // create three red zones for these two stack objects.
   int a;
@@ -646,9 +646,9 @@ TEST(AddressSanitizer, BuiltinLongJmpTest) {
   }
 }
 #endif  // !defined(__ANDROID__) && !defined(__arm__) &&
-        // !defined(__aarch64__) && !defined(__mips__)
-        // !defined(__mips64) && !defined(__s390__)
-        // !defined(__riscv)
+        // !defined(__aarch64__) && !defined(__mips__) &&
+        // !defined(__mips64) && !defined(__s390__) &&
+        // !defined(__riscv) && !defined(__loongarch__)
 
 TEST(AddressSanitizer, UnderscopeLongJmpTest) {
   static jmp_buf buf;

diff  --git a/compiler-rt/test/asan/CMakeLists.txt b/compiler-rt/test/asan/CMakeLists.txt
index d02ee4b5bd680..3c4d2cf45a39b 100644
--- a/compiler-rt/test/asan/CMakeLists.txt
+++ b/compiler-rt/test/asan/CMakeLists.txt
@@ -14,7 +14,7 @@ if(OS_NAME MATCHES "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND
 endif()
 
 macro(get_bits_for_arch arch bits)
-  if (${arch} MATCHES "x86_64|powerpc64|powerpc64le|aarch64|arm64|mips64|mips64el|s390x|sparcv9|riscv64")
+  if (${arch} MATCHES "x86_64|powerpc64|powerpc64le|aarch64|arm64|mips64|mips64el|s390x|sparcv9|riscv64|loongarch64")
     set(${bits} 64)
   elseif (${arch} MATCHES "i386|arm|mips|mipsel|sparc")
     set(${bits} 32)


        


More information about the llvm-commits mailing list