Permalink
Browse files

Align vmsize as well as filesize for mmap

  • Loading branch information...
1 parent 8e6140a commit 9ffb01dafc6b8aa5fbb8ac180399ebc8aa756c99 @shinh committed Nov 20, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 ld-mac.cc
View
@@ -395,7 +395,7 @@ class MachOLoader {
}
*base = min(*base, vmaddr);
- intptr vmsize = seg->vmsize;
+ intptr vmsize = alignMem(seg->vmsize, 0x1000);
LOG << "mmap(file) " << mach.filename() << ' ' << name
<< ": " << (void*)vmaddr << "-" << (void*)(vmaddr + filesize)
<< " offset=" << mach.offset() + seg->fileoff << endl;
@@ -407,11 +407,11 @@ class MachOLoader {
}
if (vmsize != filesize) {
- CHECK(vmsize > filesize);
LOG << "mmap(anon) " << mach.filename() << ' ' << name
<< ": " << (void*)(vmaddr + filesize) << "-"
<< (void*)(vmaddr + vmsize)
<< endl;
+ CHECK(vmsize > filesize);
void* mapped = mmap((void*)(vmaddr + filesize),
vmsize - filesize, prot,
MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS,

0 comments on commit 9ffb01d

Please sign in to comment.