ps1/exe: fill pad.code section with zeros.
This commit is contained in:
+1
-1
@@ -386,8 +386,8 @@ int ElfLinker::addLoader(const char *sname)
|
|||||||
}
|
}
|
||||||
memcpy(output + outputlen, section->input, section->size);
|
memcpy(output + outputlen, section->input, section->size);
|
||||||
section->output = output + outputlen;
|
section->output = output + outputlen;
|
||||||
|
//printf("section added: 0x%04x %3d %s\n", outputlen, section->size, section->name);
|
||||||
outputlen += section->size;
|
outputlen += section->size;
|
||||||
//printf("section added: %s\n", sect);
|
|
||||||
|
|
||||||
if (head)
|
if (head)
|
||||||
{
|
{
|
||||||
|
|||||||
+6
-3
@@ -345,7 +345,9 @@ void PackPs1::buildLoader(const Filter *)
|
|||||||
initLoader(nrv_loader, sizeof(nrv_loader));
|
initLoader(nrv_loader, sizeof(nrv_loader));
|
||||||
|
|
||||||
pad_code = ALIGN_GAP((ph.c_len + (isCon ? sz_lcpr : 0)), 4);
|
pad_code = ALIGN_GAP((ph.c_len + (isCon ? sz_lcpr : 0)), 4);
|
||||||
linker->addSection("pad.code", &pad_code, pad_code, 0);
|
assert(pad_code < 4);
|
||||||
|
static const unsigned char pad_buffer[4] = { 0, 0, 0, 0 };
|
||||||
|
linker->addSection("pad.code", pad_buffer, pad_code, 0);
|
||||||
|
|
||||||
if (isCon)
|
if (isCon)
|
||||||
{
|
{
|
||||||
@@ -533,8 +535,6 @@ void PackPs1::pack(OutputFile *fo)
|
|||||||
oh.bs_ptr = oh.bs_len = 0;
|
oh.bs_ptr = oh.bs_len = 0;
|
||||||
|
|
||||||
const int lsize = getLoaderSize();
|
const int lsize = getLoaderSize();
|
||||||
MemBuffer loader(lsize);
|
|
||||||
memcpy(loader, getLoader(), lsize);
|
|
||||||
|
|
||||||
unsigned filelen = ALIGN_UP(ih.tx_len, 4);
|
unsigned filelen = ALIGN_UP(ih.tx_len, 4);
|
||||||
|
|
||||||
@@ -614,6 +614,9 @@ void PackPs1::pack(OutputFile *fo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
linker->relocate();
|
linker->relocate();
|
||||||
|
//linker->dumpSymbols();
|
||||||
|
MemBuffer loader(lsize);
|
||||||
|
assert(lsize == getLoaderSize());
|
||||||
memcpy(loader, getLoader(), lsize);
|
memcpy(loader, getLoader(), lsize);
|
||||||
patchPackHeader(loader, lsize);
|
patchPackHeader(loader, lsize);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user