diff options
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index dd7c1a3..d1b0a58 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -416,9 +416,17 @@ private: #endif // GLIBC_INITS_RSEQ size_t FunctionDataCopySize = this->Function.FunctionBytes.size(); + void *MapAddress = NULL; + int MapFlags = MAP_PRIVATE | MAP_ANONYMOUS; + + if (Key.SnippetAddress != 0) { + MapAddress = reinterpret_cast<void *>(Key.SnippetAddress); + MapFlags |= MAP_FIXED_NOREPLACE; + } + char *FunctionDataCopy = - (char *)mmap(NULL, FunctionDataCopySize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); + (char *)mmap(MapAddress, FunctionDataCopySize, PROT_READ | PROT_WRITE, + MapFlags, 0, 0); if ((intptr_t)FunctionDataCopy == -1) exit(ChildProcessExitCodeE::FunctionDataMappingFailed); |