diff --git a/include/os/linux/spl/sys/isa_defs.h b/include/os/linux/spl/sys/isa_defs.h index a032aae91..ee3b74607 100644 --- a/include/os/linux/spl/sys/isa_defs.h +++ b/include/os/linux/spl/sys/isa_defs.h @@ -206,9 +206,13 @@ * RISC-V arch specific defines * only RV64G (including atomic) LP64 is supported yet */ -#elif defined(__riscv) && defined(_LP64) && _LP64 && \ +#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64 && \ defined(__riscv_atomic) && __riscv_atomic +#if !defined(_LP64) +#define _LP64 1 +#endif + #ifndef __riscv__ #define __riscv__ #endif diff --git a/lib/libspl/include/sys/isa_defs.h b/lib/libspl/include/sys/isa_defs.h index 756adff15..114cca4f1 100644 --- a/lib/libspl/include/sys/isa_defs.h +++ b/lib/libspl/include/sys/isa_defs.h @@ -227,9 +227,13 @@ extern "C" { * RISC-V arch specific defines * only RV64G (including atomic) LP64 is supported yet */ -#elif defined(__riscv) && defined(_LP64) && _LP64 && \ +#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64 && \ defined(__riscv_atomic) && __riscv_atomic +#if !defined(_LP64) +#define _LP64 1 +#endif + #ifndef __riscv__ #define __riscv__ #endif