Packer::defineDecompressorSymbols added
This commit is contained in:
parent
3fbbaa5130
commit
b83698ebf5
@ -230,6 +230,7 @@ protected:
|
||||
virtual const char *getDecompressorSections() const;
|
||||
virtual unsigned getDecompressorWrkmemSize() const;
|
||||
virtual void patchDecompressor(void *, int);
|
||||
virtual void defineDecompressorSymbols();
|
||||
|
||||
// filter handling [see packer_f.cpp]
|
||||
virtual bool isValidFilter(int filter_id) const;
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
#include "conf.h"
|
||||
#include "packer.h"
|
||||
#include "linker.h"
|
||||
//#include "filter.h"
|
||||
|
||||
|
||||
@ -264,6 +265,35 @@ void Packer::patchDecompressor(void *loader, int lsize)
|
||||
}
|
||||
}
|
||||
|
||||
void Packer::defineDecompressorSymbols()
|
||||
{
|
||||
if (UPX_F_LINUX_ELF_i386 ==ph.format
|
||||
|| UPX_F_LINUX_ELFI_i386 ==ph.format
|
||||
|| UPX_F_LINUX_ELF64_AMD ==ph.format
|
||||
|| UPX_F_LINUX_ELF32_ARMLE==ph.format
|
||||
|| UPX_F_LINUX_ELFPPC32 ==ph.format
|
||||
|| UPX_F_LINUX_ELF32_ARMBE==ph.format ) {
|
||||
// ELF calls the decompressor many times; the parameters change!
|
||||
return;
|
||||
}
|
||||
if (ph.method == M_LZMA)
|
||||
{
|
||||
const lzma_compress_result_t *res = &ph.compress_result.result_lzma;
|
||||
// FIXME - this is for i386 only
|
||||
unsigned properties = // lc, lp, pb, dummy
|
||||
(res->lit_context_bits << 0) |
|
||||
(res->lit_pos_bits << 8) |
|
||||
(res->pos_bits << 16);
|
||||
|
||||
linker->defineSymbol("UPXd", properties);
|
||||
// -2 for properties
|
||||
linker->defineSymbol("UPXc", ph.c_len - 2);
|
||||
linker->defineSymbol("UPXb", ph.u_len);
|
||||
unsigned stack = getDecompressorWrkmemSize();
|
||||
linker->defineSymbol("UPXa", 0u - stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
vi:ts=4:et:nowrap
|
||||
|
||||
Loading…
Reference in New Issue
Block a user