[llvm] 5058d73 - [llvm-exegesis] Add MAP_FIXED_NOREPLACE definiton

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 00:47:15 PST 2023


Author: Aiden Grossman
Date: 2023-12-07T00:47:04-08:00
New Revision: 5058d738bae15d88acc3d2977c713f43f09cb7a8

URL: https://github.com/llvm/llvm-project/commit/5058d738bae15d88acc3d2977c713f43f09cb7a8
DIFF: https://github.com/llvm/llvm-project/commit/5058d738bae15d88acc3d2977c713f43f09cb7a8.diff

LOG: [llvm-exegesis] Add MAP_FIXED_NOREPLACE definiton

MAP_FIXED_NOREPLACE doesn't exist on older kernels, so we need to define
it to be MAP_FIXED.

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index d1b0a58281cd4..8e242cdd1d905 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -44,7 +44,14 @@
 #define GLIBC_INITS_RSEQ
 #endif
 #endif
+
+// Before kernel 4.17, Linux did not support MAP_FIXED_NOREPLACE, so if it is
+// not available, simplfy define it as MAP_FIXED which performs the same
+// function but does not guarantee existing mappings won't get clobbered.
+#ifndef MAP_FIXED_NOREPLACE
+#define MAP_FIXED_NOREPLACE MAP_FIXED
 #endif
+#endif // __linux__
 
 namespace llvm {
 namespace exegesis {


        


More information about the llvm-commits mailing list