[PATCH] D158375: [llvm-exegesis] Use mmap2 when mmap is unavailable to fix riscv32 build

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 10:43:06 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG01a92f06f235: [llvm-exegesis] Use mmap2 when mmap is unavailable to fix riscv32 build (authored by raj.khem, committed by MaskRay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158375/new/

https://reviews.llvm.org/D158375

Files:
  llvm/tools/llvm-exegesis/lib/X86/Target.cpp
  llvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp


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,11 @@
 #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 don't have mmap and define 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.
+#if defined(SYS_mmap2) && !defined(SYS_mmap)
 #define SYS_mmap SYS_mmap2
 #endif
 
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,11 @@
 #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 don't have mmap and define 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.
+#if defined(SYS_mmap2) && !defined(SYS_mmap)
 #define SYS_mmap SYS_mmap2
 #endif
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158375.553537.patch
Type: text/x-patch
Size: 1994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230825/8cc6e4f1/attachment.bin>


More information about the llvm-commits mailing list