summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/MemoryBuffer.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2014-08-04 01:43:37 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2014-08-04 01:43:37 +0000
commit56bc3419a3b33fc8c110001c0ab06fced4b6a6df (patch)
tree990165f972cfcaf8dbce9420812fa81d48dde442 /llvm/lib/Support/MemoryBuffer.cpp
parent37a18821cd8b0df5ac877659d2d397f0e268407c (diff)
downloadbcm5719-llvm-56bc3419a3b33fc8c110001c0ab06fced4b6a6df.tar.gz
bcm5719-llvm-56bc3419a3b33fc8c110001c0ab06fced4b6a6df.zip
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
Diffstat (limited to 'llvm/lib/Support/MemoryBuffer.cpp')
-rw-r--r--llvm/lib/Support/MemoryBuffer.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index 5f4b7daae53..522c365f3d5 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -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;
}
OpenPOWER on IntegriCloud