[PATCH] D87558: [RISCV][ASAN] mark asan as supported for RISCV and enable tests

Anatoly Parshincev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 12 08:38:05 PDT 2020


EccoTheDolphin updated this revision to Diff 291395.
EccoTheDolphin added a comment.

restore combined diff


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87558

Files:
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/lib/asan/scripts/asan_symbolize.py
  compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
  compiler-rt/test/asan/CMakeLists.txt
  compiler-rt/test/asan/TestCases/Linux/ptrace.cpp
  compiler-rt/test/asan/TestCases/Linux/vfork.cpp


Index: compiler-rt/test/asan/TestCases/Linux/vfork.cpp
===================================================================
--- compiler-rt/test/asan/TestCases/Linux/vfork.cpp
+++ compiler-rt/test/asan/TestCases/Linux/vfork.cpp
@@ -1,7 +1,7 @@
 // https://github.com/google/sanitizers/issues/925
 // RUN: %clang_asan -O0 %s -o %t && %run %t 2>&1
 
-// REQUIRES: aarch64-target-arch || x86_64-target-arch || i386-target-arch || arm-target-arch
+// REQUIRES: aarch64-target-arch || x86_64-target-arch || i386-target-arch || arm-target-arch || riscv64-target-arch
 
 #include <assert.h>
 #include <sys/types.h>
Index: compiler-rt/test/asan/TestCases/Linux/ptrace.cpp
===================================================================
--- compiler-rt/test/asan/TestCases/Linux/ptrace.cpp
+++ compiler-rt/test/asan/TestCases/Linux/ptrace.cpp
@@ -66,6 +66,14 @@
 #define PRINT_REG_PC(__regs)    printf ("%lx\n", (unsigned long) (__regs.psw.addr))
 #define PRINT_REG_FP(__fpregs)  printf ("%lx\n", (unsigned long) (__fpregs.fpc))
 #define ARCH_IOVEC_FOR_GETREGSET
+
+#elif defined(__riscv) && (__riscv_xlen == 64)
+#include <asm/ptrace.h>
+typedef user_regs_struct regs_struct;
+typedef __riscv_q_ext_state fpregs_struct;
+#define PRINT_REG_PC(__regs) printf("%lx\n", (unsigned long)(__regs.pc))
+#define PRINT_REG_FP(__fpregs) printf("%lx\n", (unsigned long)(__fpregs.fcsr))
+#define ARCH_IOVEC_FOR_GETREGSET
 #endif
 
 
Index: compiler-rt/test/asan/CMakeLists.txt
===================================================================
--- compiler-rt/test/asan/CMakeLists.txt
+++ compiler-rt/test/asan/CMakeLists.txt
@@ -14,7 +14,7 @@
 endif()
 
 macro(get_bits_for_arch arch bits)
-  if (${arch} MATCHES "x86_64|powerpc64|powerpc64le|aarch64|arm64|mips64|mips64el|s390x|sparcv9")
+  if (${arch} MATCHES "x86_64|powerpc64|powerpc64le|aarch64|arm64|mips64|mips64el|s390x|sparcv9|riscv64")
     set(${bits} 64)
   elseif (${arch} MATCHES "i386|arm|mips|mipsel|sparc")
     set(${bits} 32)
Index: compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
===================================================================
--- compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
+++ compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
@@ -3,7 +3,7 @@
 clang_compiler_add_cxx_check()
 
 # FIXME: use SANITIZER_COMMON_SUPPORTED_ARCH here
-filter_available_targets(SANITIZER_UNITTEST_SUPPORTED_ARCH x86_64 i386 mips64 mips64el)
+filter_available_targets(SANITIZER_UNITTEST_SUPPORTED_ARCH x86_64 i386 mips64 mips64el riscv64)
 if(APPLE)
   darwin_filter_host_archs(SANITIZER_UNITTEST_SUPPORTED_ARCH SANITIZER_UNITTEST_SUPPORTED_ARCH)
 endif()
Index: compiler-rt/lib/asan/scripts/asan_symbolize.py
===================================================================
--- compiler-rt/lib/asan/scripts/asan_symbolize.py
+++ compiler-rt/lib/asan/scripts/asan_symbolize.py
@@ -49,7 +49,8 @@
 
 def is_valid_arch(s):
   return s in ["i386", "x86_64", "x86_64h", "arm", "armv6", "armv7", "armv7s",
-               "armv7k", "arm64", "powerpc64", "powerpc64le", "s390x", "s390"]
+               "armv7k", "arm64", "powerpc64", "powerpc64le", "s390x", "s390",
+               "riscv64"]
 
 def guess_arch(addr):
   # Guess which arch we're running. 10 = len('0x') + 8 hex digits.
Index: compiler-rt/cmake/config-ix.cmake
===================================================================
--- compiler-rt/cmake/config-ix.cmake
+++ compiler-rt/cmake/config-ix.cmake
@@ -294,7 +294,7 @@
 
 set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} ${RISCV64}
     ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9})
-set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
+set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
     ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9})
 set(ALL_CRT_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV32} ${RISCV64})
 set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87558.291395.patch
Type: text/x-patch
Size: 3962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200912/a58ef8b7/attachment.bin>


More information about the llvm-commits mailing list