MemoryBuffer: Don't use mmap when FileSize is multiple of 4k on Cygwin.

On Cygwin, getpagesize() returns 64k(AllocationGranularity).

In r214580, the size of X86GenInstrInfo.inc became 1499136.

FIXME: We should reorganize again getPageSize() on Win32.
MapFile allocates address along AllocationGranularity but view is mapped by physical page.

llvm-svn: 214681
This commit is contained in:
NAKAMURA Takumi 2014-08-04 01:43:37 +00:00
parent 37a18821cd
commit 56bc3419a3
1 changed files with 8 additions and 0 deletions

View File

@ -305,6 +305,14 @@ static bool shouldUseMmap(int FD,
if ((FileSize & (PageSize -1)) == 0)
return false;
#if defined(__CYGWIN__)
// Don't try to map files that are exactly a multiple of the physical page size
// if we need a null terminator.
// FIXME: We should reorganize again getPageSize() on Win32.
if ((FileSize & (4096 - 1)) == 0)
return false;
#endif
return true;
}