1
0
mirror of https://github.com/upx/upx synced 2025-10-05 19:20:23 +08:00

remove patchFilter32()

This commit is contained in:
John Reiser 2006-08-22 20:49:28 -07:00
parent 12e4bcba5d
commit 579ce20cad
5 changed files with 16 additions and 25 deletions

View File

@ -416,8 +416,15 @@ void PackLinuxElf32x86::addStubEntrySections(Filter const *ft)
addLoader("FOLDEXEC", NULL);
}
void PackLinuxElf32x86::addLinkerSymbols(Filter const */*ft*/)
void PackLinuxElf32x86::addLinkerSymbols(Filter const *const ft)
{
if (0x80==(ft->id & 0xF0)) {
int const mru = ft->n_mru ? 1+ ft->n_mru : 0;
if (mru && mru!=256) {
unsigned const is_pwr2 = (0==((mru -1) & mru));
linker->defineSymbol("NMRU", mru - is_pwr2);
}
}
}
int

View File

@ -376,6 +376,13 @@ PackLinuxI386::buildLinuxLoader(
unsigned const stack = getDecompressorWrkmemSize();
linker->defineSymbol("UPXa", 0u - stack);
}
if (0x80==(ft->id & 0xF0)) {
int const mru = ft->n_mru ? 1+ ft->n_mru : 0;
if (mru && mru!=256) {
unsigned const is_pwr2 = (0==((mru -1) & mru));
linker->defineSymbol("NMRU", mru - is_pwr2);
}
}
linker->relocate();
return getLoaderSize();
}

View File

@ -236,11 +236,10 @@ PackUnix::patchLoaderChecksum()
lp->l_checksum = upx_adler32(ptr, lsize);
}
void PackUnix::pack3(OutputFile *fo, Filter &ft)
void PackUnix::pack3(OutputFile *fo, Filter &/*ft*/)
{
upx_byte *p = getLoader();
lsize = getLoaderSize();
patchFilter32(p, lsize, &ft);
updateLoader(fo);
patchLoaderChecksum();
fo->write(p, lsize);

View File

@ -237,7 +237,6 @@ protected:
virtual void optimizeFilter(Filter *, const upx_byte *, unsigned) const
{ }
virtual void addFilter32(int filter_id);
virtual bool patchFilter32(void *, int, const Filter *ft);
// stub and overlay util
static void handleStub(InputFile *fi, OutputFile *fo, long size);

View File

@ -360,27 +360,6 @@ void Packer::addFilter32(int filter_id)
#undef MRUFLT
/*************************************************************************
// patchFilter32
**************************************************************************/
bool Packer::patchFilter32(void *loader, int lsize, const Filter *ft)
{
if (ft->id == 0)
return false;
assert(ft->calls > 0);
if (0x80==(ft->id & 0xF0)) {
int const mru = ph.n_mru ? 1+ ph.n_mru : 0;
if (mru && mru!=256) {
unsigned const is_pwr2 = (0==((mru -1) & mru));
patch_le32(0x80 + (char *)loader, lsize - 0x80, "NMRU", mru - is_pwr2);
}
}
return true;
}
/*
vi:ts=4:et:nowrap
*/