Allow the PE sections to cross a page boundary.
committer: mfx <mfx> 1142603590 +0000
This commit is contained in:
+7
-6
@@ -1930,18 +1930,19 @@ void PackW32Pe::pack(OutputFile *fo)
|
||||
if (swri >= 0x1000)
|
||||
throwCantPack("swri >= 0x1000! Send a bug report please!");
|
||||
patch_le32(loader, codesize, "SWRI", swri);
|
||||
patch_le32(loader, codesize, "IMGL", 0x1000); // one page
|
||||
patch_le32(loader, codesize, "IMGB", 0u - rvamin);
|
||||
#else
|
||||
// make sure we only touch exactly one page
|
||||
// make sure we only touch the minimum number of pages
|
||||
const unsigned addr = 0u - rvamin + swri;
|
||||
patch_le32(loader, codesize, "SWRI", addr & 0xfff); // page offset
|
||||
patch_le32(loader, codesize, "IMGB", addr &~ 0xfff); // page mask
|
||||
|
||||
// check whether osection[0].flags and osection[1].flags
|
||||
// are on the same page
|
||||
if ((swri & ~0xfff) != ((swri + sizeof(pe_section_t)) & ~0xfff))
|
||||
throwCantPack("DEPHAK: page crossing problem! "
|
||||
"Send a bug report please!");
|
||||
if ((addr & 0xfff) + 0x28 >= 0x1000)
|
||||
patch_le32(loader, codesize, "IMGL", 0x2000); // two pages
|
||||
else
|
||||
patch_le32(loader, codesize, "IMGL", 0x1000); // one page
|
||||
patch_le32(loader, codesize, "IMGB", addr &~ 0xfff); // page mask
|
||||
#endif
|
||||
patch_le32(loader, codesize, "VPRO", myimport + get_le32(oimpdlls + 16) + 8);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user