1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

::addStubEntrySections() with default ELFMAINX

This commit is contained in:
John Reiser 2006-07-09 08:48:06 -07:00
parent 6bd9805bcc
commit 1a0a64e4de
2 changed files with 30 additions and 11 deletions

View File

@ -150,19 +150,24 @@ PackLinuxElf::PackLinuxElf(InputFile *f)
{ {
} }
Linker *PackLinuxElf::newLinker() const
{
return new ElfLinker;
}
PackLinuxElf::~PackLinuxElf() PackLinuxElf::~PackLinuxElf()
{ {
delete[] file_image; delete[] file_image;
} }
Linker* PackLinuxElf64amd::newLinker() const Linker *PackLinuxElf::newLinker() const
{ {
return new ElfLinkerAMD64; return new ElfLinker;
}
void
PackLinuxElf::addStubEntrySections(
upx_byte const *const proto,
unsigned const szproto
)
{
linker->addSection("ELFMAINX", proto, szproto);
addLoader("ELFMAINX", NULL);
} }
PackLinuxElf32::PackLinuxElf32(InputFile *f) PackLinuxElf32::PackLinuxElf32(InputFile *f)
@ -186,6 +191,11 @@ PackLinuxElf64::~PackLinuxElf64()
delete[] phdri; delete[] phdri;
} }
Linker* PackLinuxElf64amd::newLinker() const
{
return new ElfLinkerAMD64;
}
int const * int const *
PackLinuxElf::getCompressionMethods(int method, int level) const PackLinuxElf::getCompressionMethods(int method, int level) const
{ {
@ -512,9 +522,8 @@ PackLinuxElf32::buildLinuxLoader(
//int const GAP = 128; // must match stub/l_mac_ppc.S //int const GAP = 128; // must match stub/l_mac_ppc.S
//segcmdo.vmsize += sz_unc - sz_cpr + GAP + 64; //segcmdo.vmsize += sz_unc - sz_cpr + GAP + 64;
linker->addSection("ELFMAINX", proto, szproto); addStubEntrySections(proto, szproto);
addLoader("ELFMAINX", NULL);
addLoader("FOLDEXEC", NULL); addLoader("FOLDEXEC", NULL);
freezeLoader(); freezeLoader();
return getLoaderSize(); return getLoaderSize();
@ -568,14 +577,22 @@ PackLinuxElf64::buildLinuxLoader(
linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + sz_cpr); linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + sz_cpr);
delete [] cprLoader; delete [] cprLoader;
linker->addSection("ELFMAINX", proto, szproto); addStubEntrySections(proto, szproto);
addLoader("ELFMAINX", NULL);
addLoader("FOLDEXEC", NULL); addLoader("FOLDEXEC", NULL);
freezeLoader(); freezeLoader();
return getLoaderSize(); return getLoaderSize();
} }
void
PackLinuxElf64amd::addStubEntrySections(
upx_byte const *const /*proto*/,
unsigned const /*szproto*/
)
{
// FIXME
}
static const static const
#include "stub/i386-linux.elf-entry.h" #include "stub/i386-linux.elf-entry.h"
static const static const

View File

@ -60,6 +60,7 @@ protected:
void const *proto, void const *proto,
unsigned const brka unsigned const brka
) = 0; ) = 0;
virtual void addStubEntrySections(upx_byte const *, unsigned);
virtual void unpack(OutputFile *fo) = 0; virtual void unpack(OutputFile *fo) = 0;
protected: protected:
@ -286,6 +287,7 @@ protected:
virtual void pack3(OutputFile *, Filter &); // append loader virtual void pack3(OutputFile *, Filter &); // append loader
virtual const int *getCompressionMethods(int method, int level) const; virtual const int *getCompressionMethods(int method, int level) const;
virtual int buildLoader(const Filter *); virtual int buildLoader(const Filter *);
virtual void addStubEntrySections(upx_byte const *, unsigned);
virtual Linker* newLinker() const; virtual Linker* newLinker() const;
}; };