Put upx stub loader at high end of ELF output file on linux,
and allow for block-by-block specification of filter and parameters. linker.cpp linker.h mem.cpp mem.h p_elf.h p_lx_elf.cpp p_lx_elf.h p_lx_exc.cpp p_lx_exc.h p_lx_sh.cpp p_lx_sh.h p_unix.cpp p_unix.h packer.cpp packer.h stub/fold_elf86.asm stub/fold_exec86.asm stub/fold_sh86.asm stub/l_lx_elf.c stub/l_lx_elf86.asm stub/l_lx_elf86.lds stub/l_lx_exec.c stub/l_lx_exec86.asm stub/l_lx_exec86.lds stub/l_lx_sh.c stub/l_lx_sh86.asm stub/l_lx_sh86.lds stub/linux.hh committer: jreiser <jreiser> 981084316 +0000
This commit is contained in:
-42
@@ -47,15 +47,6 @@ MemBuffer::~MemBuffer()
|
||||
this->free();
|
||||
}
|
||||
|
||||
MemBufferIO::MemBufferIO(unsigned size) :
|
||||
MemBuffer(size)
|
||||
{
|
||||
}
|
||||
|
||||
MemBufferIO::~MemBufferIO()
|
||||
{
|
||||
}
|
||||
|
||||
void MemBuffer::free()
|
||||
{
|
||||
if (alloc_ptr)
|
||||
@@ -75,39 +66,6 @@ unsigned MemBuffer::getSize() const
|
||||
}
|
||||
|
||||
|
||||
unsigned MemBufferIO::seek(unsigned offset, int whence)
|
||||
{
|
||||
switch (whence) {
|
||||
default: {
|
||||
assert(false);
|
||||
} break;
|
||||
case SEEK_SET: {
|
||||
assert(offset<=alloc_size);
|
||||
ptr = offset + alloc_ptr;
|
||||
} break;
|
||||
case SEEK_CUR: {
|
||||
assert((offset + (ptr - alloc_ptr))<=alloc_size);
|
||||
ptr += offset;
|
||||
} break;
|
||||
case SEEK_END: {
|
||||
assert((offset + alloc_size)<=alloc_size);
|
||||
ptr = offset + alloc_size + alloc_ptr;
|
||||
} break;
|
||||
}
|
||||
return ptr - alloc_ptr;
|
||||
}
|
||||
|
||||
unsigned MemBufferIO::write(void const *data, unsigned size)
|
||||
{
|
||||
unsigned const avail = getSize();
|
||||
unsigned const len = UPX_MIN(size, avail);
|
||||
if (data!=ptr) {
|
||||
memmove(ptr, data, len);
|
||||
}
|
||||
ptr += len;
|
||||
return len;
|
||||
}
|
||||
|
||||
void MemBuffer::alloc(unsigned size, unsigned base_offset)
|
||||
{
|
||||
#if 0
|
||||
|
||||
Reference in New Issue
Block a user