Skip to content

Commit c63207e

Browse files
committed
[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. Add a prefix on the symbols, and make an undeclared function static. This fixes such an issue reported at mstorsjo/llvm-mingw#390.
1 parent 66786a7 commit c63207e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

compiler-rt/lib/profile/WindowsMMap.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ int madvise(void *addr, size_t length, int advice)
124124
return 0;
125125
}
126126

127-
COMPILER_RT_VISIBILITY
128-
int lock(HANDLE handle, DWORD lockType, BOOL blocking) {
127+
static int lock(HANDLE handle, DWORD lockType, BOOL blocking) {
129128
DWORD flags = lockType;
130129
if (!blocking)
131130
flags |= LOCKFILE_FAIL_IMMEDIATELY;

compiler-rt/lib/profile/WindowsMMap.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@
6060
# define DWORD_LO(x) (x)
6161
#endif
6262

63+
#define mmap __llvm_profile_mmap
64+
#define munmap __llvm_profile_munmap
65+
#define msync __llvm_profile_msync
66+
#define madvise __llvm_profile_madvise
67+
#define flock __llvm_profile_flock
68+
6369
void *mmap(void *start, size_t length, int prot, int flags, int fd,
6470
off_t offset);
6571

0 commit comments

Comments
 (0)