1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Extensive runtime refactor to reduce generated executable sizes

This commit is contained in:
Brian Fiete 2024-03-16 07:23:29 -04:00
parent 4e750a7e1a
commit ddd9b1b218
74 changed files with 2514 additions and 717 deletions

View file

@ -509,7 +509,7 @@ addr_target COFF::GetSectionAddr(uint16 section, uint32 offset)
return hiBase + offset;
}
int rva = mSectionRVAs[section - 1];
int rva = mSectionHeaders[section - 1].mVirtualAddress;
if (rva == 0)
return ADDR_FLAG_ABS + offset;
@ -5178,6 +5178,7 @@ bool COFF::CvParseDBI(int wantAge)
contribEntry->mLength = curSize;
contribEntry->mDbgModule = this;
contribEntry->mCompileUnitId = contrib.mModule;
contribEntry->mSection = contrib.mSection;
mDebugTarget->mContribMap.Insert(contribEntry);
}
}
@ -5288,7 +5289,7 @@ bool COFF::CvParseDBI(int wantAge)
void COFF::ParseSectionHeader(int sectionIdx)
{
bool fakeRVAS = mSectionRVAs.empty();
bool fakeRVAS = mSectionHeaders.empty();
int sectionSize = 0;
uint8* sectionData = CvReadStream(sectionIdx, &sectionSize);
@ -5300,12 +5301,15 @@ void COFF::ParseSectionHeader(int sectionIdx)
auto& sectionHeader = GET(PESectionHeader);
if (fakeRVAS)
{
mSectionRVAs.push_back(sectionHeader.mVirtualAddress);
mSectionHeaders.push_back(sectionHeader);
}
}
if (fakeRVAS)
mSectionRVAs.push_back(0);
{
PESectionHeader sectionHeader = { 0 };
mSectionHeaders.push_back(sectionHeader);
}
delete sectionData;
}