diff --git a/src/coreclr/minipal/Unix/doublemapping.cpp b/src/coreclr/minipal/Unix/doublemapping.cpp index a50b326861aada..6e0278e3ccd69f 100644 --- a/src/coreclr/minipal/Unix/doublemapping.cpp +++ b/src/coreclr/minipal/Unix/doublemapping.cpp @@ -14,10 +14,11 @@ #include #include #include -#ifdef TARGET_LINUX +#if defined(TARGET_LINUX) && !defined(MFD_CLOEXEC) #include #include // __NR_memfd_create -#endif // TARGET_LINUX +#define memfd_create(...) syscall(__NR_memfd_create, __VA_ARGS__) +#endif // TARGET_LINUX && !MFD_CLOEXEC #include "minipal.h" #if defined(TARGET_OSX) && defined(TARGET_AMD64) @@ -32,10 +33,6 @@ static const off_t MaxDoubleMappedSize = 2048ULL*1024*1024*1024; static const off_t MaxDoubleMappedSize = UINT_MAX; #endif -#ifdef TARGET_LINUX -#define memfd_create(...) syscall(__NR_memfd_create, __VA_ARGS__) -#endif // TARGET_LINUX - #endif // TARGET_OSX bool VMToOSInterface::CreateDoubleMemoryMapper(void** pHandle, size_t *pMaxExecutableCodeSize)