[compiler-rt] [compiler-rt] Add a prefix on the windows mmap symbols (PR #78037)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 13 06:12:19 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-platform-windows

Author: Martin Storsjö (mstorsjo)

<details>
<summary>Changes</summary>

For Windows, the compiler-rt profile library contains a polyfill reimplementation of the mmap family of functions.

Previously, the runtime library exposed those symbols like, "mmap", in the user symbol namespace. This could cause misdetections by configure scripts that check for the "mmap" function just by linking, without including headers.

This fixes such an issue reported at
https://github.com/mstorsjo/llvm-mingw/issues/390.

---
Full diff: https://github.com/llvm/llvm-project/pull/78037.diff


1 Files Affected:

- (modified) compiler-rt/lib/profile/WindowsMMap.h (+6) 


``````````diff
diff --git a/compiler-rt/lib/profile/WindowsMMap.h b/compiler-rt/lib/profile/WindowsMMap.h
index 68b8de2398d606..1df1a0be0b02bd 100644
--- a/compiler-rt/lib/profile/WindowsMMap.h
+++ b/compiler-rt/lib/profile/WindowsMMap.h
@@ -60,6 +60,12 @@
 # define DWORD_LO(x) (x)
 #endif
 
+#define mmap __llvm_profile_mmap
+#define munmap __llvm_profile_munmap
+#define msync __llvm_profile_msync
+#define madvise __llvm_profile_madvise
+#define flock __llvm_profile_flock
+
 void *mmap(void *start, size_t length, int prot, int flags, int fd,
            off_t offset);
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/78037


More information about the llvm-commits mailing list