Skip to content

Commit edccc3b

Browse files
committed
Don't define mmap for the clang toolchain.
The `mmap` definition problem only occurs with the GCC toolchain. With the clang toolchain we should not redefine `mmap`, and instead use the definition from the NDK headers.
1 parent 58f9211 commit edccc3b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mono/utils/mono-compiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ typedef int32_t __mono_off32_t;
171171
#include <sys/mman.h>
172172
#endif
173173

174-
#if !defined(mmap)
174+
#if !defined(mmap) && !defined(__clang__)
175175
/* Unified headers before API 21 do not declare mmap when LARGE_FILES are used (via -D_FILE_OFFSET_BITS=64)
176176
* which is always the case when Mono build targets Android. The problem here is that the unified headers
177177
* map `mmap` to `mmap64` if large files are enabled but this api exists only in API21 onwards. Therefore
178178
* we must carefully declare the 32-bit mmap here without changing the ABI along the way. Carefully because
179179
* in this instance off_t is redeclared to be 64-bit and that's not what we want.
180180
*/
181-
//void* mmap (void*, size_t, int, int, int, __mono_off32_t);
181+
void* mmap (void*, size_t, int, int, int, __mono_off32_t);
182182
#endif /* !mmap */
183183

184184
#ifdef HAVE_SYS_SENDFILE_H

0 commit comments

Comments
 (0)