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

Add Packer::hasLoaderSection() to handle missing CFLUSH sections.

This commit is contained in:
Markus F.X.J. Oberhumer 2008-04-07 18:44:00 +02:00
parent 6c8bb3a22e
commit d54f947c98
4 changed files with 12 additions and 2 deletions

View File

@ -193,7 +193,9 @@ PackLinuxElf::addStubEntrySections(Filter const *)
: M_IS_NRV2B(ph.method) ? "NRV_HEAD,NRV2B,NRV_TAIL"
: M_IS_LZMA(ph.method) ? "LZMA_ELF00,+80C,LZMA_DEC20,LZMA_DEC30"
: NULL), NULL);
addLoader("CFLUSH,ELFMAINY,IDENTSTR,+40,ELFMAINZ,FOLDEXEC", NULL);
if (hasLoaderSection("CFLUSH"))
addLoader("CFLUSH");
addLoader("ELFMAINY,IDENTSTR,+40,ELFMAINZ,FOLDEXEC", NULL);
}

View File

@ -104,7 +104,9 @@ PackMachBase<T>::addStubEntrySections(Filter const *)
: M_IS_NRV2B(ph.method) ? "NRV_HEAD,NRV2B,NRV_TAIL"
: M_IS_LZMA(ph.method) ? "LZMA_ELF00,LZMA_DEC20,LZMA_DEC30"
: NULL), NULL);
addLoader("CFLUSH,ELFMAINY,IDENTSTR,+40,ELFMAINZ,FOLDEXEC", NULL);
if (hasLoaderSection("CFLUSH"))
addLoader("CFLUSH");
addLoader("ELFMAINY,IDENTSTR,+40,ELFMAINZ,FOLDEXEC", NULL);
}
void PackMachI386::addStubEntrySections(Filter const *ft)

View File

@ -1121,6 +1121,11 @@ int Packer::getLoaderSize() const
return size;
}
bool Packer::hasLoaderSection(const char *name) const
{
void *section = linker->findSection(name, false);
return section != NULL;
}
int Packer::getLoaderSection(const char *name, int *slen) const
{

View File

@ -240,6 +240,7 @@ protected:
#else
void __acc_cdecl_va addLoaderVA(const char *s, ...);
#endif
virtual bool hasLoaderSection(const char *name) const;
virtual int getLoaderSection(const char *name, int *slen=NULL) const;
virtual int getLoaderSectionStart(const char *name, int *slen=NULL) const;