aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoly Parshintsev <kupokupokupopo@gmail.com>2020-09-22 21:30:09 -0700
committerVitaly Buka <vitalybuka@google.com>2020-09-22 21:44:04 -0700
commitdfd295431a50aa8bccc0b89da9acf3c48b3d4b29 (patch)
treedec451fccbef6764980f449f1cb1a66efc127db7
parentcabe31f415054b45b4fa6c17e4ddf09cc39bf4e8 (diff)
downloadllvm-dfd295431a50aa8bccc0b89da9acf3c48b3d4b29.zip
llvm-dfd295431a50aa8bccc0b89da9acf3c48b3d4b29.tar.gz
llvm-dfd295431a50aa8bccc0b89da9acf3c48b3d4b29.tar.bz2
[RISCV][ASAN] updated platform macros to simplify detection of RISCV64 platform
[2/11] patch series to port ASAN for riscv64 Depends On D87997 Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D87998
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_platform.h6
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp6
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h2
3 files changed, 10 insertions, 4 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
index f0b1e04..43c6e8a 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
@@ -219,6 +219,12 @@
# define SANITIZER_MYRIAD2 0
#endif
+#if defined(__riscv) && (__riscv_xlen == 64)
+#define SANITIZER_RISCV64 1
+#else
+#define SANITIZER_RISCV64 0
+#endif
+
// By default we allow to use SizeClassAllocator64 on 64-bit platform.
// But in some cases (e.g. AArch64's 39-bit address space) SizeClassAllocator64
// does not work well and we need to fallback to SizeClassAllocator32.
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
index c052aa2..c80132b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -229,9 +229,9 @@ namespace __sanitizer {
#if SANITIZER_LINUX && !SANITIZER_ANDROID
// Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
// has been removed from glibc 2.28.
-#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
- || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
- || defined(__x86_64__) || (defined(__riscv) && __riscv_xlen == 64)
+#if defined(__aarch64__) || defined(__s390x__) || defined(__mips64) || \
+ defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) || \
+ defined(__x86_64__) || SANITIZER_RISCV64
#define SIZEOF_STRUCT_USTAT 32
#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
|| defined(__powerpc__) || defined(__s390__) || defined(__sparc__)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index 658b0ab..0f43e18 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -99,7 +99,7 @@ const unsigned struct_kernel_stat64_sz = 144;
const unsigned struct___old_kernel_stat_sz = 0;
const unsigned struct_kernel_stat_sz = 64;
const unsigned struct_kernel_stat64_sz = 104;
-#elif defined(__riscv) && __riscv_xlen == 64
+#elif SANITIZER_RISCV64
const unsigned struct_kernel_stat_sz = 128;
const unsigned struct_kernel_stat64_sz = 104;
#endif