Index: libc/cmake/modules/LLVMLibCArchitectures.cmake =================================================================== --- libc/cmake/modules/LLVMLibCArchitectures.cmake +++ libc/cmake/modules/LLVMLibCArchitectures.cmake @@ -17,6 +17,9 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") set(LIBC_TARGET_ARCHITECTURE_IS_POWER TRUE) set(LIBC_TARGET_ARCHITECTURE "power") +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv64|riscv)") + set(LIBC_TARGET_ARCHITECTURE_IS_POWER TRUE) + set(LIBC_TARGET_ARCHITECTURE "riscv") else() message(FATAL_ERROR "Unsupported processor ${CMAKE_SYSTEM_PROCESSOR}") endif() Index: libc/src/__support/architectures.h =================================================================== --- libc/src/__support/architectures.h +++ libc/src/__support/architectures.h @@ -33,6 +33,10 @@ #define LLVM_LIBC_ARCH_AARCH64 #endif +#if defined(__riscv) || defined(__riscv__) +#define LLVM_LIBC_ARCH_RISCV +#endif + #if (defined(LLVM_LIBC_ARCH_AARCH64) || defined(LLVM_LIBC_ARCH_ARM)) #define LLVM_LIBC_ARCH_ANY_ARM #endif Index: libc/src/string/memory_utils/utils.h =================================================================== --- libc/src/string/memory_utils/utils.h +++ libc/src/string/memory_utils/utils.h @@ -15,7 +15,8 @@ // cache line sizes depend on implementations, not architectures. There // are even implementations with cache line sizes configurable at boot // time. -#if defined(LLVM_LIBC_ARCH_AARCH64) || defined(LLVM_LIBC_ARCH_X86) || defined(LLVM_LIBC_ARCH_RISCV) +#if defined(LLVM_LIBC_ARCH_AARCH64) || defined(LLVM_LIBC_ARCH_X86) || \ + defined(LLVM_LIBC_ARCH_RISCV) #define LLVM_LIBC_CACHELINE_SIZE 64 #else #error "Unsupported platform for memory functions."