Index: llvm/tools/llvm-exegesis/lib/X86/Target.cpp =================================================================== --- llvm/tools/llvm-exegesis/lib/X86/Target.cpp +++ llvm/tools/llvm-exegesis/lib/X86/Target.cpp @@ -1087,11 +1087,12 @@ #define MAP_FIXED_NOREPLACE MAP_FIXED #endif -// 32 bit ARM doesn't have mmap and uses mmap2 instead. The only difference -// between the two syscalls is that mmap2's offset parameter is in terms 4096 -// byte offsets rather than individual bytes, so for our purposes they are -// effectively the same as all ofsets here are set to 0. -#ifdef __arm__ +// some 32-bit architectures e.g. ARM, RISCV32 don't have mmap and use mmap2 +// instead. The only difference between the two syscalls is that mmap2's +// offset parameter is in terms of 4096 byte offsets rather than individual +// bytes, so for our purposes they are effectively the same as all ofsets +// here are set to 0. +#if defined(SYS_mmap2) && !defined(SYS_mmap) #define SYS_mmap SYS_mmap2 #endif Index: llvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp =================================================================== --- llvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp +++ llvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp @@ -635,11 +635,12 @@ #define MAP_FIXED_NOREPLACE MAP_FIXED #endif -// 32 bit ARM doesn't have mmap and uses mmap2 instead. The only difference -// between the two syscalls is that mmap2's offset parameter is in terms 4096 -// byte offsets rather than individual bytes, so for our purposes they are -// effectively the same as all ofsets here are set to 0. -#ifdef __arm__ +// some 32-bit architectures e.g. ARM, RISCV32 don't have mmap and use mmap2 +// instead. The only difference between the two syscalls is that mmap2's +// offset parameter is in terms of 4096 byte offsets rather than individual +// bytes, so for our purposes they are effectively the same as all ofsets +// here are set to 0. +#if defined(SYS_mmap2) && !defined(SYS_mmap) #define SYS_mmap SYS_mmap2 #endif