[compiler-rt] dfd2954 - [RISCV][ASAN] updated platform macros to simplify detection of RISCV64 platform
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 22 21:44:20 PDT 2020
Author: Anatoly Parshintsev
Date: 2020-09-22T21:44:04-07:00
New Revision: dfd295431a50aa8bccc0b89da9acf3c48b3d4b29
URL: https://github.com/llvm/llvm-project/commit/dfd295431a50aa8bccc0b89da9acf3c48b3d4b29
DIFF: https://github.com/llvm/llvm-project/commit/dfd295431a50aa8bccc0b89da9acf3c48b3d4b29.diff
LOG: [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
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_platform.h
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
index f0b1e04d1dd6..43c6e8a03c16 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 c052aa2bc950..c80132bb25ea 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 658b0abaece8..0f43e18e7f81 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
More information about the llvm-commits
mailing list