[compiler-rt] [compiler-rt] Add a prefix on the windows mmap symbols (PR #78037)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 13 06:12:02 PST 2024
https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/78037
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.
>From d52cd6cc515f57cf896138f7d03de615eddd2357 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Sat, 13 Jan 2024 16:04:14 +0200
Subject: [PATCH] [compiler-rt] Add a prefix on the windows mmap symbols
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.
---
compiler-rt/lib/profile/WindowsMMap.h | 6 ++++++
1 file changed, 6 insertions(+)
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);
More information about the llvm-commits
mailing list