Index: contrib/compiler-rt/lib/builtins/int_lib.h =================================================================== --- contrib/compiler-rt/lib/builtins/int_lib.h +++ contrib/compiler-rt/lib/builtins/int_lib.h @@ -78,7 +78,7 @@ * mips64 with GCC 4.2.1. */ #if defined(__FreeBSD__) && (defined(__sparc64__) || \ - defined(__mips_n64) || defined(__mips_o64)) + defined(__mips_n64) || defined(__mips_o64) || defined(__riscv__)) si_int __clzsi2(si_int); si_int __ctzsi2(si_int); #define __builtin_clz __clzsi2 Index: contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h =================================================================== --- contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -76,6 +76,9 @@ #elif defined(__powerpc64__) const unsigned struct_kernel_stat_sz = 144; const unsigned struct_kernel_stat64_sz = 104; +#elif defined(__riscv__) + const unsigned struct_kernel_stat_sz = 128; + const unsigned struct_kernel_stat64_sz = 104; #elif defined(__mips__) #if SANITIZER_WORDSIZE == 64 const unsigned struct_kernel_stat_sz = 216; @@ -178,7 +181,7 @@ unsigned __seq; u64 __unused1; u64 __unused2; -#elif defined(__mips__) || defined(__aarch64__) +#elif defined(__aarch64__) || defined(__mips__) || defined(__riscv__) unsigned int mode; unsigned short __seq; unsigned short __pad1; Index: contrib/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc =================================================================== --- contrib/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc +++ contrib/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc @@ -88,7 +88,7 @@ uptr GetMaxVirtualAddress() { #if SANITIZER_WORDSIZE == 64 -# if defined(__powerpc64__) || defined(__aarch64__) +# if defined(__aarch64__) || defined(__powerpc64__) || defined(__riscv__) // On PowerPC64 we have two different address space layouts: 44- and 46-bit. // We somehow need to figure out which one we are using now and choose // one of 0x00000fffffffffffUL and 0x00003fffffffffffUL. Index: contrib/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h =================================================================== --- contrib/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h +++ contrib/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h @@ -19,9 +19,9 @@ static const u32 kStackTraceMax = 256; -#if SANITIZER_LINUX && (defined(__aarch64__) || defined(__powerpc__) || \ - defined(__powerpc64__) || defined(__sparc__) || \ - defined(__mips__)) +#if SANITIZER_LINUX && (defined(__aarch64__) || defined(__mips__) || \ + defined(__powerpc__) || defined(__powerpc64__) || \ + defined(__riscv__) || defined(__sparc__)) # define SANITIZER_CAN_FAST_UNWIND 0 #elif SANITIZER_WINDOWS # define SANITIZER_CAN_FAST_UNWIND 0