Merge.
This commit is contained in:
commit
b8a16ea99d
@ -459,6 +459,7 @@ inline void operator delete[](void *p)
|
||||
#define UPX_F_LINUX_ELFI_i386 20
|
||||
#define UPX_F_WINCE_ARM_PE 21
|
||||
#define UPX_F_LINUX_ELF64_AMD 22
|
||||
#define UPX_F_LINUX_ELF32_ARM 23
|
||||
|
||||
#define UPX_F_PLAIN_TEXT 127
|
||||
|
||||
|
||||
572
src/p_lx_elf.cpp
572
src/p_lx_elf.cpp
@ -150,13 +150,15 @@ PackLinuxElf::~PackLinuxElf()
|
||||
}
|
||||
|
||||
PackLinuxElf32::PackLinuxElf32(InputFile *f)
|
||||
: super(f), phdri(NULL)
|
||||
: super(f), phdri(NULL),
|
||||
file_image(NULL), dynseg(NULL), hashtab(NULL), dynstr(NULL), dynsym(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
PackLinuxElf32::~PackLinuxElf32()
|
||||
{
|
||||
delete[] phdri;
|
||||
delete[] file_image;
|
||||
}
|
||||
|
||||
PackLinuxElf64::PackLinuxElf64(InputFile *f)
|
||||
@ -205,6 +207,14 @@ PackLinuxElf64amd::getCompressionMethods(int method, int level) const
|
||||
return m_nrv2e;
|
||||
}
|
||||
|
||||
int const *
|
||||
PackLinuxElf32arm::getCompressionMethods(int /*method*/, int /*level*/) const
|
||||
{
|
||||
static const int m_nrv2e[] = { M_NRV2E_8, -1 };
|
||||
|
||||
return m_nrv2e;
|
||||
}
|
||||
|
||||
int const *
|
||||
PackLinuxElf32ppc::getFilters() const
|
||||
{
|
||||
@ -399,7 +409,7 @@ PackLinuxElf32x86::buildLinuxLoader(
|
||||
}
|
||||
|
||||
int
|
||||
PackLinuxElf32ppc::buildLinuxLoader(
|
||||
PackLinuxElf32::buildLinuxLoader(
|
||||
upx_byte const *const proto,
|
||||
unsigned const szproto,
|
||||
upx_byte const *const fold,
|
||||
@ -448,15 +458,15 @@ PackLinuxElf32ppc::buildLinuxLoader(
|
||||
//int const GAP = 128; // must match stub/l_mac_ppc.S
|
||||
//segcmdo.vmsize += sz_unc - sz_cpr + GAP + 64;
|
||||
|
||||
linker->addSection("ELF32PPC", proto, szproto);
|
||||
linker->addSection("ELFMAINX", proto, szproto);
|
||||
|
||||
addLoader("ELF32PPC", NULL);
|
||||
addLoader("ELFMAINX", NULL);
|
||||
addLoader("FOLDEXEC", NULL);
|
||||
return getLoaderSize();
|
||||
}
|
||||
|
||||
int
|
||||
PackLinuxElf64amd::buildLinuxLoader(
|
||||
PackLinuxElf64::buildLinuxLoader(
|
||||
upx_byte const *const proto,
|
||||
unsigned const szproto,
|
||||
upx_byte const *const fold,
|
||||
@ -502,16 +512,56 @@ PackLinuxElf64amd::buildLinuxLoader(
|
||||
linker->addSection("FOLDEXEC", cprLoader, sizeof(h) + sz_cpr);
|
||||
delete [] cprLoader;
|
||||
|
||||
linker->addSection("ELF64AMD", proto, szproto);
|
||||
linker->addSection("ELFMAINX", proto, szproto);
|
||||
|
||||
addLoader("ELF64AMD", NULL);
|
||||
addLoader("ELFMAINX", NULL);
|
||||
addLoader("FOLDEXEC", NULL);
|
||||
return getLoaderSize();
|
||||
}
|
||||
|
||||
static const
|
||||
#include "stub/l_lx_elfppc32.h"
|
||||
#include "stub/l_lx_elf86.h"
|
||||
static const
|
||||
#include "stub/fold_elf86.h"
|
||||
|
||||
int
|
||||
PackLinuxElf32x86::buildLoader(const Filter *ft)
|
||||
{
|
||||
unsigned char tmp[sizeof(linux_i386elf_fold)];
|
||||
memcpy(tmp, linux_i386elf_fold, sizeof(linux_i386elf_fold));
|
||||
checkPatch(NULL, 0, 0, 0); // reset
|
||||
if (opt->o_unix.is_ptinterp) {
|
||||
unsigned j;
|
||||
for (j = 0; j < sizeof(linux_i386elf_fold)-1; ++j) {
|
||||
if (0x60==tmp[ j]
|
||||
&& 0x47==tmp[1+j] ) {
|
||||
/* put INC EDI before PUSHA: inhibits auxv_up for PT_INTERP */
|
||||
tmp[ j] = 0x47;
|
||||
tmp[1+j] = 0x60;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return buildLinuxLoader(
|
||||
linux_i386elf_loader, sizeof(linux_i386elf_loader),
|
||||
tmp, sizeof(linux_i386elf_fold), ft );
|
||||
}
|
||||
|
||||
static const
|
||||
#include "stub/l_lx_elf32arm.h"
|
||||
static const
|
||||
#include "stub/fold_elf32arm.h"
|
||||
|
||||
int
|
||||
PackLinuxElf32arm::buildLoader(const Filter *ft)
|
||||
{
|
||||
return buildLinuxLoader(
|
||||
linux_elf32arm_loader, sizeof(linux_elf32arm_loader),
|
||||
linux_elf32arm_fold, sizeof(linux_elf32arm_fold), ft );
|
||||
}
|
||||
|
||||
static const
|
||||
#include "stub/l_lx_elfppc32.h"
|
||||
static const
|
||||
#include "stub/fold_elfppc32.h"
|
||||
|
||||
@ -525,7 +575,6 @@ PackLinuxElf32ppc::buildLoader(const Filter *ft)
|
||||
|
||||
static const
|
||||
#include "stub/l_lx_elf64amd.h"
|
||||
|
||||
static const
|
||||
#include "stub/fold_elf64amd.h"
|
||||
|
||||
@ -699,7 +748,7 @@ PackLinuxElf64::getbrk(const Elf64_Phdr *phdr, int e_phnum) const
|
||||
|
||||
void
|
||||
PackLinuxElf32::generateElfHdr(
|
||||
OutputFile */*fo*/,
|
||||
OutputFile *fo,
|
||||
void const *proto,
|
||||
unsigned const brka
|
||||
)
|
||||
@ -737,11 +786,21 @@ PackLinuxElf32::generateElfHdr(
|
||||
h2->phdr[1].p_memsz = 0;
|
||||
#undef PAGE_MASK
|
||||
}
|
||||
if (ph.format==getFormat()) {
|
||||
cprElfHdr2 *const h2 = (cprElfHdr2 *)&elfout;
|
||||
assert(2==get_native16(&h2->ehdr.e_phnum));
|
||||
set_native32(&h2->phdr[0].p_flags, ~Elf32_Phdr::PF_W & get_native32(&h2->phdr[0].p_flags));
|
||||
memset(&h2->linfo, 0, sizeof(h2->linfo));
|
||||
fo->write(h2, sizeof(*h2));
|
||||
}
|
||||
else {
|
||||
assert(false); // unknown ph.format, PackLinuxElf32
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PackLinuxElf64::generateElfHdr(
|
||||
OutputFile */*fo*/,
|
||||
OutputFile *fo,
|
||||
void const *proto,
|
||||
unsigned const brka
|
||||
)
|
||||
@ -779,60 +838,7 @@ PackLinuxElf64::generateElfHdr(
|
||||
h2->phdr[1].p_memsz = 0;
|
||||
#undef PAGE_MASK
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PackLinuxElf32x86::generateElfHdr(
|
||||
OutputFile *fo,
|
||||
void const *proto,
|
||||
unsigned const brka
|
||||
)
|
||||
{
|
||||
super::generateElfHdr(fo, proto, brka);
|
||||
|
||||
if (ph.format==UPX_F_LINUX_ELF_i386) {
|
||||
cprElfHdr2 *const h2 = (cprElfHdr2 *)&elfout;
|
||||
assert(2==get_native16(&h2->ehdr.e_phnum));
|
||||
set_native32(&h2->phdr[0].p_flags, ~Elf32_Phdr::PF_W & get_native32(&h2->phdr[0].p_flags));
|
||||
memset(&h2->linfo, 0, sizeof(h2->linfo));
|
||||
fo->write(h2, sizeof(*h2));
|
||||
}
|
||||
else {
|
||||
assert(false); // unknown ph.format, PackLinuxElf32x86::generateElfHdr
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PackLinuxElf32ppc::generateElfHdr(
|
||||
OutputFile *fo,
|
||||
void const *proto,
|
||||
unsigned const brka
|
||||
)
|
||||
{
|
||||
super::generateElfHdr(fo, proto, brka);
|
||||
|
||||
if (ph.format==UPX_F_LINUX_ELFPPC32) {
|
||||
cprElfHdr2 *const h2 = (cprElfHdr2 *)&elfout;
|
||||
assert(2==get_native16(&h2->ehdr.e_phnum));
|
||||
set_native32(&h2->phdr[0].p_flags, ~Elf32_Phdr::PF_W & get_native32(&h2->phdr[0].p_flags));
|
||||
memset(&h2->linfo, 0, sizeof(h2->linfo));
|
||||
fo->write(h2, sizeof(*h2));
|
||||
}
|
||||
else {
|
||||
assert(false); // unknown ph.format, PackLinuxElf32ppc::generateElfHdr
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PackLinuxElf64amd::generateElfHdr(
|
||||
OutputFile *fo,
|
||||
void const *proto,
|
||||
unsigned const brka
|
||||
)
|
||||
{
|
||||
super::generateElfHdr(fo, proto, brka);
|
||||
|
||||
if (ph.format==UPX_F_LINUX_ELF64_AMD) {
|
||||
if (ph.format==getFormat()) {
|
||||
cprElfHdr2 *const h2 = (cprElfHdr2 *)&elfout;
|
||||
assert(2==get_native16(&h2->ehdr.e_phnum));
|
||||
set_native32(&h2->phdr[0].p_flags, ~Elf64_Phdr::PF_W & get_native32(&h2->phdr[0].p_flags));
|
||||
@ -840,16 +846,11 @@ PackLinuxElf64amd::generateElfHdr(
|
||||
fo->write(h2, sizeof(*h2));
|
||||
}
|
||||
else {
|
||||
assert(false); // unknown ph.format, PackLinuxElf64amd::generateElfHdr
|
||||
assert(false); // unknown ph.format, PackLinuxElf64
|
||||
}
|
||||
}
|
||||
|
||||
static const
|
||||
#include "stub/l_lx_elf86.h"
|
||||
static const
|
||||
#include "stub/fold_elf86.h"
|
||||
|
||||
void PackLinuxElf32::pack1(OutputFile *fo, Filter &/*ft*/)
|
||||
void PackLinuxElf32::pack1(OutputFile */*fo*/, Filter &/*ft*/)
|
||||
{
|
||||
fi->seek(0, SEEK_SET);
|
||||
fi->readx(&ehdri, sizeof(ehdri));
|
||||
@ -862,10 +863,28 @@ void PackLinuxElf32::pack1(OutputFile *fo, Filter &/*ft*/)
|
||||
fi->seek(e_phoff, SEEK_SET);
|
||||
fi->readx(phdri, sz_phdrs);
|
||||
|
||||
generateElfHdr(fo, linux_elfppc32_fold, getbrk(phdri, e_phnum) );
|
||||
progid = getRandomId();
|
||||
}
|
||||
|
||||
void PackLinuxElf64::pack1(OutputFile *fo, Filter &/*ft*/)
|
||||
void PackLinuxElf32x86::pack1(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
super::pack1(fo, ft);
|
||||
generateElfHdr(fo, linux_i386elf_fold, getbrk(phdri, ehdri.e_phnum) );
|
||||
}
|
||||
|
||||
void PackLinuxElf32arm::pack1(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
super::pack1(fo, ft);
|
||||
generateElfHdr(fo, linux_elf32arm_fold, getbrk(phdri, ehdri.e_phnum) );
|
||||
}
|
||||
|
||||
void PackLinuxElf32ppc::pack1(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
super::pack1(fo, ft);
|
||||
generateElfHdr(fo, linux_elfppc32_fold, getbrk(phdri, ehdri.e_phnum) );
|
||||
}
|
||||
|
||||
void PackLinuxElf64::pack1(OutputFile */*fo*/, Filter &/*ft*/)
|
||||
{
|
||||
fi->seek(0, SEEK_SET);
|
||||
fi->readx(&ehdri, sizeof(ehdri));
|
||||
@ -878,7 +897,13 @@ void PackLinuxElf64::pack1(OutputFile *fo, Filter &/*ft*/)
|
||||
fi->seek(e_phoff, SEEK_SET);
|
||||
fi->readx(phdri, sz_phdrs);
|
||||
|
||||
generateElfHdr(fo, linux_elf64amd_fold, getbrk(phdri, e_phnum) );
|
||||
progid = getRandomId();
|
||||
}
|
||||
|
||||
void PackLinuxElf64amd::pack1(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
super::pack1(fo, ft);
|
||||
generateElfHdr(fo, linux_elf64amd_fold, getbrk(phdri, ehdri.e_phnum) );
|
||||
}
|
||||
|
||||
// Determine length of gap between PT_LOAD phdri[k] and closest PT_LOAD
|
||||
@ -1085,14 +1110,14 @@ void PackLinuxElf64::pack2(OutputFile *fo, Filter &ft)
|
||||
set_native64(&elfout.phdr[0].p_filesz, fo->getBytesWritten());
|
||||
}
|
||||
|
||||
void PackLinuxElf32ppc::pack3(OutputFile *fo, Filter &ft)
|
||||
void PackLinuxElf32::pack3(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
unsigned disp;
|
||||
unsigned const zero = 0;
|
||||
unsigned len = fo->getBytesWritten();
|
||||
fo->write(&zero, 3& -len); // align to 0 mod 4
|
||||
len += (3& -len) + sizeof(disp);
|
||||
set_native32(&disp, 4+ len - sz_elf_hdrs); // 4: sizeof(instruction)
|
||||
len += (3& -len);
|
||||
set_native32(&disp, len); // FIXME? -(sz_elf_hdrs+sizeof(l_info)+sizeof(p_info))
|
||||
fo->write(&disp, sizeof(disp));
|
||||
|
||||
super::pack3(fo, ft);
|
||||
@ -1166,6 +1191,66 @@ void PackLinuxElf64amd::pack3(OutputFile *fo, Filter &ft)
|
||||
super::pack3(fo, ft);
|
||||
}
|
||||
|
||||
void PackLinuxElf32arm::pack3(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
unsigned const hlen = sz_elf_hdrs + sizeof(l_info) + sizeof(p_info);
|
||||
unsigned const len0 = fo->getBytesWritten();
|
||||
unsigned len = len0;
|
||||
unsigned const zero = 0;
|
||||
fo->write(&zero, 3& -len); // align to 0 mod 4
|
||||
len += (3& -len);
|
||||
|
||||
#define PAGE_MASK (~0u<<12)
|
||||
#define PAGE_SIZE (-PAGE_MASK)
|
||||
upx_byte *const p = const_cast<upx_byte *>(getLoader());
|
||||
lsize = getLoaderSize();
|
||||
unsigned const lo_va_user = 0x8000; // XXX
|
||||
unsigned lo_va_stub = elfout.phdr[0].p_vaddr;
|
||||
unsigned adrc;
|
||||
unsigned adrm;
|
||||
unsigned adrx;
|
||||
unsigned cntc;
|
||||
unsigned lenm;
|
||||
|
||||
len += lsize;
|
||||
bool const is_big = true;
|
||||
if (is_big) {
|
||||
elfout.ehdr.e_entry += lo_va_user - lo_va_stub;
|
||||
elfout.phdr[0].p_vaddr = lo_va_user;
|
||||
elfout.phdr[0].p_paddr = lo_va_user;
|
||||
lo_va_stub = lo_va_user;
|
||||
adrc = lo_va_stub;
|
||||
adrm = getbrk(phdri, ehdri.e_phnum);
|
||||
adrx = hlen + (PAGE_MASK & (~PAGE_MASK + adrm)); // round up to page boundary
|
||||
lenm = PAGE_SIZE + len;
|
||||
cntc = len >> 5;
|
||||
}
|
||||
else {
|
||||
adrm = lo_va_stub + len;
|
||||
adrc = adrm;
|
||||
adrx = lo_va_stub + hlen;
|
||||
lenm = PAGE_SIZE;
|
||||
cntc = 0;
|
||||
}
|
||||
adrm = PAGE_MASK & (~PAGE_MASK + adrm); // round up to page boundary
|
||||
adrc = PAGE_MASK & (~PAGE_MASK + adrc); // round up to page boundary
|
||||
|
||||
// patch in order of descending address
|
||||
patch_le32(p,lsize,"ADRX", adrx); // compressed input for eXpansion
|
||||
patch_le32(p,lsize,"LENX", len0 - hlen);
|
||||
|
||||
patch_le32(p,lsize,"CNTC", cntc); // count for copy
|
||||
patch_le32(p,lsize,"ADRC", adrc); // addr for copy
|
||||
|
||||
patch_le32(p,lsize,"LENM", lenm); // len for map
|
||||
patch_le32(p,lsize,"ADRM", adrm); // addr for map
|
||||
|
||||
#undef PAGE_SIZE
|
||||
#undef PAGE_MASK
|
||||
|
||||
super::pack3(fo, ft);
|
||||
}
|
||||
|
||||
void PackLinuxElf::pack4(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
super::pack4(fo, ft);
|
||||
@ -1201,7 +1286,8 @@ void PackLinuxElf32::pack4(OutputFile *fo, Filter &ft)
|
||||
elfout.ehdr.e_entry -= base;
|
||||
elfout.phdr[0].p_vaddr -= base;
|
||||
elfout.phdr[0].p_paddr -= base;
|
||||
elfout.phdr[0].p_flags |= Elf32_Phdr::PF_W;
|
||||
// Strict SELinux (or PaX, grSecurity) disallows PF_W with PF_X
|
||||
//elfout.phdr[0].p_flags |= Elf32_Phdr::PF_W;
|
||||
}
|
||||
fo->seek(0, SEEK_SET);
|
||||
fo->rewrite(&elfout, sz_elf_hdrs);
|
||||
@ -1450,16 +1536,12 @@ void PackLinuxElf64::unpack(OutputFile *fo)
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
PackLinuxElf32x86::PackLinuxElf32x86(InputFile *f) :
|
||||
super(f), phdri(NULL),
|
||||
file_image(NULL), dynseg(NULL), hashtab(NULL), dynstr(NULL), dynsym(NULL)
|
||||
PackLinuxElf32x86::PackLinuxElf32x86(InputFile *f) : super(f)
|
||||
{
|
||||
}
|
||||
|
||||
PackLinuxElf32x86::~PackLinuxElf32x86()
|
||||
{
|
||||
delete[] file_image;
|
||||
delete[] phdri;
|
||||
}
|
||||
|
||||
int const *
|
||||
@ -1485,33 +1567,6 @@ PackLinuxElf32x86::getFilters() const
|
||||
return filters;
|
||||
}
|
||||
|
||||
int
|
||||
PackLinuxElf32x86::buildLoader(const Filter *ft)
|
||||
{
|
||||
unsigned char tmp[sizeof(linux_i386elf_fold)];
|
||||
memcpy(tmp, linux_i386elf_fold, sizeof(linux_i386elf_fold));
|
||||
checkPatch(NULL, 0, 0, 0); // reset
|
||||
if (opt->o_unix.is_ptinterp) {
|
||||
unsigned j;
|
||||
for (j = 0; j < sizeof(linux_i386elf_fold)-1; ++j) {
|
||||
if (0x60==tmp[ j]
|
||||
&& 0x47==tmp[1+j] ) {
|
||||
/* put INC EDI before PUSHA: inhibits auxv_up for PT_INTERP */
|
||||
tmp[ j] = 0x47;
|
||||
tmp[1+j] = 0x60;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return buildLinuxLoader(
|
||||
linux_i386elf_loader, sizeof(linux_i386elf_loader),
|
||||
tmp, sizeof(linux_i386elf_fold), ft );
|
||||
}
|
||||
|
||||
|
||||
void PackLinuxElf32x86::patchLoader() { }
|
||||
|
||||
|
||||
bool PackLinuxElf32x86::canPack()
|
||||
{
|
||||
unsigned char buf[sizeof(Elf32_Ehdr) + 14*sizeof(Elf32_Phdr)];
|
||||
@ -1620,8 +1675,131 @@ bool PackLinuxElf32x86::canPack()
|
||||
return true;
|
||||
}
|
||||
|
||||
PackLinuxElf32arm::PackLinuxElf32arm(InputFile *f) : super(f)
|
||||
{
|
||||
}
|
||||
|
||||
PackLinuxElf32arm::~PackLinuxElf32arm()
|
||||
{
|
||||
}
|
||||
|
||||
const int *
|
||||
PackLinuxElf32arm::getFilters() const
|
||||
{
|
||||
static const int filters[] = { 0x50, -1 };
|
||||
return filters;
|
||||
}
|
||||
|
||||
bool PackLinuxElf32arm::canPack()
|
||||
{
|
||||
unsigned char buf[sizeof(Elf32_Ehdr) + 14*sizeof(Elf32_Phdr)];
|
||||
COMPILE_TIME_ASSERT(sizeof(buf) <= 512);
|
||||
|
||||
exetype = 0;
|
||||
|
||||
fi->readx(buf, sizeof(buf));
|
||||
fi->seek(0, SEEK_SET);
|
||||
Elf32_Ehdr const *const ehdr = (Elf32_Ehdr const *)buf;
|
||||
|
||||
// now check the ELF header
|
||||
if (checkEhdr(ehdr, Elf32_Ehdr::EM_ARM,
|
||||
Elf32_Ehdr::ELFCLASS32, Elf32_Ehdr::ELFDATA2LSB) != 0)
|
||||
return false;
|
||||
|
||||
// additional requirements for linux/elfarm
|
||||
if (ehdr->e_ehsize != sizeof(*ehdr)) {
|
||||
throwCantPack("invalid Ehdr e_ehsize; try `--force-execve'");
|
||||
return false;
|
||||
}
|
||||
if (ehdr->e_phoff != sizeof(*ehdr)) {// Phdrs not contiguous with Ehdr
|
||||
throwCantPack("non-contiguous Ehdr/Phdr; try `--force-execve'");
|
||||
return false;
|
||||
}
|
||||
|
||||
// The first PT_LOAD32 must cover the beginning of the file (0==p_offset).
|
||||
Elf32_Phdr const *phdr = (Elf32_Phdr const *)(buf + ehdr->e_phoff);
|
||||
for (unsigned j=0; j < ehdr->e_phnum; ++phdr, ++j) {
|
||||
if (j >= 14) // 512 bytes holds Elf32_Ehdr + Elf32_Phdr[0..13]
|
||||
return false;
|
||||
if (phdr->PT_LOAD32 == get_native32(&phdr->p_type)) {
|
||||
if (phdr->p_offset != 0) {
|
||||
throwCantPack("invalid Phdr p_offset; try `--force-execve'");
|
||||
return false;
|
||||
}
|
||||
|
||||
// detect possible conflict upon invocation
|
||||
//if (ehdr->e_type!=Elf32_Ehdr::ET_DYN
|
||||
//&& (phdr->p_vaddr < (unsigned)(0x4000 + file_size)
|
||||
// || phdr->p_paddr < (unsigned)(0x4000 + file_size) ) ) {
|
||||
// throwAlreadyPackedByUPX(); // not necessarily, but mostly true
|
||||
// return false;
|
||||
//}
|
||||
exetype = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We want to compress position-independent executable (gcc -pie)
|
||||
// main programs, but compressing a shared library must be avoided
|
||||
// because the result is no longer usable. In theory, there is no way
|
||||
// to tell them apart: both are just ET_DYN. Also in theory,
|
||||
// neither the presence nor the absence of any particular symbol name
|
||||
// can be used to tell them apart; there are counterexamples.
|
||||
// However, we will use the following heuristic suggested by
|
||||
// Peter S. Mazinger <ps.m@gmx.net> September 2005:
|
||||
// If a ET_DYN has __libc_start_main as a global undefined symbol,
|
||||
// then the file is a position-independent executable main program
|
||||
// (that depends on libc.so.6) and is eligible to be compressed.
|
||||
// Otherwise (no __libc_start_main as global undefined): skip it.
|
||||
// Also allow __uClibc_main and __uClibc_start_main .
|
||||
|
||||
if (Elf32_Ehdr::ET_DYN==ehdr->e_type) {
|
||||
// The DT_STRTAB has no designated length. Read the whole file.
|
||||
file_image = new char[file_size];
|
||||
fi->seek(0, SEEK_SET);
|
||||
fi->readx(file_image, file_size);
|
||||
ehdri= *ehdr;
|
||||
phdri= (Elf32_Phdr *)(ehdr->e_phoff + file_image); // do not free() !!
|
||||
|
||||
int j= ehdr->e_phnum;
|
||||
phdr= phdri;
|
||||
for (; --j>=0; ++phdr) if (Elf32_Phdr::PT_DYNAMIC==get_native32(&phdr->p_type)) {
|
||||
dynseg= (Elf32_Dyn const *)(get_native32(&phdr->p_offset) + file_image);
|
||||
break;
|
||||
}
|
||||
// elf_find_dynamic() returns 0 if 0==dynseg.
|
||||
hashtab= (unsigned int const *)elf_find_dynamic(Elf32_Dyn::DT_HASH);
|
||||
dynstr= (char const *)elf_find_dynamic(Elf32_Dyn::DT_STRTAB);
|
||||
dynsym= (Elf32_Sym const *)elf_find_dynamic(Elf32_Dyn::DT_SYMTAB);
|
||||
|
||||
char const *const run_start[]= {
|
||||
"__libc_start_main", "__uClibc_main", "__uClibc_start_main",
|
||||
};
|
||||
for (j=0; j<3; ++j) {
|
||||
// elf_lookup() returns 0 if any required table is missing.
|
||||
Elf32_Sym const *const lsm = elf_lookup(run_start[j]);
|
||||
if (lsm && lsm->st_shndx==Elf32_Sym::SHN_UNDEF
|
||||
&& lsm->st_info==lsm->Elf32_Sym::St_info(Elf32_Sym::STB_GLOBAL, Elf32_Sym::STT_FUNC)
|
||||
&& lsm->st_other==Elf32_Sym::STV_DEFAULT ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
phdri = 0; // done "borrowing" this member
|
||||
if (3<=j) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!super::canPack())
|
||||
return false;
|
||||
assert(exetype == 1);
|
||||
|
||||
// set options
|
||||
opt->o_unix.blocksize = blocksize = file_size;
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned
|
||||
PackLinuxElf32x86::elf_get_offset_from_address(unsigned const addr) const
|
||||
PackLinuxElf32::elf_get_offset_from_address(unsigned const addr) const
|
||||
{
|
||||
Elf32_Phdr const *phdr = phdri;
|
||||
int j = ehdri.e_phnum;
|
||||
@ -1635,7 +1813,7 @@ PackLinuxElf32x86::elf_get_offset_from_address(unsigned const addr) const
|
||||
}
|
||||
|
||||
void const *
|
||||
PackLinuxElf32x86::elf_find_dynamic(unsigned int const key) const
|
||||
PackLinuxElf32::elf_find_dynamic(unsigned int const key) const
|
||||
{
|
||||
Elf32_Dyn const *dynp= dynseg;
|
||||
if (dynp)
|
||||
@ -1649,7 +1827,7 @@ PackLinuxElf32x86::elf_find_dynamic(unsigned int const key) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned PackLinuxElf32x86::elf_hash(char const *p)
|
||||
unsigned PackLinuxElf32::elf_hash(char const *p)
|
||||
{
|
||||
unsigned h;
|
||||
for (h= 0; 0!=*p; ++p) {
|
||||
@ -1663,7 +1841,7 @@ unsigned PackLinuxElf32x86::elf_hash(char const *p)
|
||||
return h;
|
||||
}
|
||||
|
||||
Elf32_Sym const *PackLinuxElf32x86::elf_lookup(char const *name) const
|
||||
Elf32_Sym const *PackLinuxElf32::elf_lookup(char const *name) const
|
||||
{
|
||||
if (hashtab && dynsym && dynstr) {
|
||||
unsigned const nbucket = hashtab[0];
|
||||
@ -1682,170 +1860,6 @@ Elf32_Sym const *PackLinuxElf32x86::elf_lookup(char const *name) const
|
||||
|
||||
}
|
||||
|
||||
void PackLinuxElf32x86::pack1(OutputFile *fo, Filter &)
|
||||
{
|
||||
fi->seek(0, SEEK_SET);
|
||||
fi->readx(&ehdri, sizeof(ehdri));
|
||||
assert(ehdri.e_phoff == sizeof(Elf32_Ehdr)); // checked by canPack()
|
||||
sz_phdrs = ehdri.e_phnum * ehdri.e_phentsize;
|
||||
|
||||
phdri = new Elf32_Phdr[(unsigned)ehdri.e_phnum];
|
||||
fi->seek(ehdri.e_phoff, SEEK_SET);
|
||||
fi->readx(phdri, sz_phdrs);
|
||||
|
||||
progid = getRandomId();
|
||||
generateElfHdr(fo, linux_i386elf_fold, getbrk(phdri, ehdri.e_phnum) );
|
||||
}
|
||||
|
||||
unsigned PackLinuxElf32x86::find_LOAD_gap(
|
||||
Elf32_Phdr const *const phdri,
|
||||
unsigned const k,
|
||||
unsigned const e_phnum
|
||||
)
|
||||
{
|
||||
if (PT_LOAD32!=get_native32(&phdri[k].p_type)) {
|
||||
return 0;
|
||||
}
|
||||
unsigned const hi = get_native32(&phdri[k].p_offset) +
|
||||
get_native32(&phdri[k].p_filesz);
|
||||
unsigned lo = ph.u_file_size;
|
||||
unsigned j = k;
|
||||
for (;;) { // circular search, optimize for adjacent ascending
|
||||
++j;
|
||||
if (e_phnum==j) {
|
||||
j = 0;
|
||||
}
|
||||
if (k==j) {
|
||||
break;
|
||||
}
|
||||
if (PT_LOAD32==get_native32(&phdri[j].p_type)) {
|
||||
unsigned const t = get_native32(&phdri[j].p_offset);
|
||||
if ((t - hi) < (lo - hi)) {
|
||||
lo = t;
|
||||
if (hi==lo) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return lo - hi;
|
||||
}
|
||||
|
||||
void PackLinuxElf32x86::pack2(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
Extent x;
|
||||
unsigned k;
|
||||
|
||||
// count passes, set ptload vars
|
||||
ui_total_passes = 0;
|
||||
unsigned const e_phnum = get_native16(&ehdri.e_phnum);
|
||||
for (k = 0; k < e_phnum; ++k) {
|
||||
if (PT_LOAD32 == get_native32(&phdri[k].p_type)) {
|
||||
ui_total_passes++;
|
||||
if (find_LOAD_gap(phdri, k, e_phnum)) {
|
||||
ui_total_passes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// compress extents
|
||||
unsigned total_in = 0;
|
||||
unsigned total_out = 0;
|
||||
|
||||
unsigned hdr_ulen = sizeof(Elf32_Ehdr) + sz_phdrs;
|
||||
|
||||
ui_pass = 0;
|
||||
ft.addvalue = 0;
|
||||
|
||||
int nx = 0;
|
||||
for (k = 0; k < e_phnum; ++k) if (PT_LOAD32==get_native32(&phdri[k].p_type)) {
|
||||
if (ft.id < 0x40) {
|
||||
// FIXME: ?? ft.addvalue = phdri[k].p_vaddr;
|
||||
}
|
||||
x.offset = get_native32(&phdri[k].p_offset);
|
||||
x.size = get_native32(&phdri[k].p_filesz);
|
||||
if (0 == nx) { // 1st PT_LOAD32 must cover Ehdr at 0==p_offset
|
||||
unsigned const delta = sizeof(Elf32_Ehdr) + sz_phdrs;
|
||||
if (ft.id < 0x40) {
|
||||
// FIXME: ?? ft.addvalue += delta;
|
||||
}
|
||||
x.offset += delta;
|
||||
x.size -= delta;
|
||||
}
|
||||
packExtent(x, total_in, total_out,
|
||||
((Elf32_Phdr::PF_X & phdri[k].p_flags)
|
||||
? &ft : 0 ), fo, hdr_ulen);
|
||||
hdr_ulen = 0;
|
||||
++nx;
|
||||
}
|
||||
for (k = 0; k < e_phnum; ++k) {
|
||||
x.size = find_LOAD_gap(phdri, k, e_phnum);
|
||||
if (x.size) {
|
||||
x.offset = get_native32(&phdri[k].p_offset) +
|
||||
get_native32(&phdri[k].p_filesz);
|
||||
packExtent(x, total_in, total_out, 0, fo);
|
||||
}
|
||||
}
|
||||
|
||||
if ((off_t)total_in != file_size)
|
||||
throwEOFException();
|
||||
set_native32(&elfout.phdr[0].p_filesz, fo->getBytesWritten());
|
||||
}
|
||||
|
||||
void PackLinuxElf32x86::pack3(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
unsigned disp;
|
||||
unsigned len = fo->getBytesWritten();
|
||||
unsigned const zero = 0;
|
||||
fo->write(&zero, 3& -len); // align to 0 mod 4
|
||||
len += (3& -len);
|
||||
set_native32(&disp, len);
|
||||
fo->write(&disp, sizeof(disp));
|
||||
|
||||
// We have packed multiple blocks, so PackLinuxElfxx::buildLinuxLoader
|
||||
// needs an adjusted ph.c_len in order to get alignment correct.
|
||||
unsigned const save_c_len = ph.c_len;
|
||||
ph.c_len = sizeof(disp) + len - (
|
||||
// Elf32_Edhr
|
||||
sizeof(elfout.ehdr) +
|
||||
// Elf32_Phdr: 1 for exec86, 2 for sh86, 3 for elf86
|
||||
(elfout.ehdr.e_phentsize * elfout.ehdr.e_phnum) +
|
||||
// checksum UPX! lsize version format
|
||||
sizeof(l_info) +
|
||||
// PT_DYNAMIC with DT_NEEDED "forwarded" from original file
|
||||
((elfout.ehdr.e_phnum==3) ? (unsigned) elfout.phdr[2].p_memsz : 0u) +
|
||||
// p_progid, p_filesize, p_blocksize
|
||||
sizeof(p_info) +
|
||||
// compressed data
|
||||
b_len );
|
||||
buildLoader(&ft); /* redo for final .align constraints */
|
||||
ph.c_len = save_c_len;
|
||||
|
||||
super::pack3(fo, ft);
|
||||
}
|
||||
|
||||
void PackLinuxElf32x86::pack4(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
super::pack4(fo, ft); // write PackHeader and overlay_offset
|
||||
|
||||
// rewrite Elf header
|
||||
if (Elf32_Ehdr::ET_DYN==ehdri.e_type) {
|
||||
// File being compressed was -pie.
|
||||
// Turn the stub into -pie, too.
|
||||
unsigned const base= elfout.phdr[0].p_vaddr;
|
||||
elfout.ehdr.e_type= Elf32_Ehdr::ET_DYN;
|
||||
elfout.ehdr.e_phnum= 1;
|
||||
elfout.ehdr.e_entry -= base;
|
||||
elfout.phdr[0].p_vaddr -= base;
|
||||
elfout.phdr[0].p_paddr -= base;
|
||||
// Strict SELinux (or PaX, grSecurity) disallows PF_W with PF_X
|
||||
//elfout.phdr[0].p_flags |= Elf32_Phdr::PF_W;
|
||||
}
|
||||
fo->seek(0, SEEK_SET);
|
||||
fo->rewrite(&elfout, sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr));
|
||||
//fo->rewrite(&linfo, sizeof(linfo));
|
||||
}
|
||||
|
||||
void PackLinuxElf32x86::unpack(OutputFile *fo)
|
||||
{
|
||||
#define MAX_ELF_HDR 512
|
||||
|
||||
106
src/p_lx_elf.h
106
src/p_lx_elf.h
@ -81,7 +81,7 @@ protected:
|
||||
|
||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
||||
//virtual void pack3(OutputFile *, Filter &); // append loader
|
||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||
virtual void pack4(OutputFile *, Filter &); // append pack header
|
||||
virtual void unpack(OutputFile *fo);
|
||||
|
||||
@ -90,6 +90,13 @@ protected:
|
||||
void const *proto,
|
||||
unsigned const brka
|
||||
);
|
||||
virtual int buildLinuxLoader(
|
||||
upx_byte const *const proto, // assembly-only sections
|
||||
unsigned const szproto,
|
||||
upx_byte const *const fold, // linked assembly + C section
|
||||
unsigned const szfold,
|
||||
Filter const *ft
|
||||
);
|
||||
virtual off_t getbrk(const Elf32_Phdr *phdr, int e_phnum) const;
|
||||
virtual void patchLoader();
|
||||
virtual void updateLoader(OutputFile *fo);
|
||||
@ -97,9 +104,21 @@ protected:
|
||||
unsigned const e_phnum);
|
||||
virtual off_t getbase(const Elf32_Phdr *phdr, int e_phnum) const;
|
||||
|
||||
static unsigned elf_hash(char const *) /*const*/;
|
||||
virtual void const *elf_find_dynamic(unsigned) const;
|
||||
virtual Elf32_Sym const *elf_lookup(char const *) const;
|
||||
virtual unsigned elf_get_offset_from_address(unsigned) const;
|
||||
|
||||
protected:
|
||||
Elf32_Ehdr ehdri; // from input file
|
||||
Elf32_Phdr *phdri; // for input file
|
||||
unsigned sz_phdrs; // sizeof Phdr[]
|
||||
|
||||
char *file_image; // if ET_DYN investigation
|
||||
Elf32_Dyn const *dynseg; // from PT_DYNAMIC
|
||||
unsigned int const *hashtab; // from DT_HASH
|
||||
char const *dynstr; // from DT_STRTAB
|
||||
Elf32_Sym const *dynsym; // from DT_SYMTAB
|
||||
|
||||
struct cprElfHdr1 {
|
||||
Elf32_Ehdr ehdr;
|
||||
@ -152,6 +171,13 @@ protected:
|
||||
void const *proto,
|
||||
unsigned const brka
|
||||
);
|
||||
virtual int buildLinuxLoader(
|
||||
upx_byte const *const proto, // assembly-only sections
|
||||
unsigned const szproto,
|
||||
upx_byte const *const fold, // linked assembly + C section
|
||||
unsigned const szfold,
|
||||
Filter const *ft
|
||||
);
|
||||
virtual off_t getbrk(const Elf64_Phdr *phdr, int e_phnum) const;
|
||||
virtual void patchLoader();
|
||||
virtual void updateLoader(OutputFile *fo);
|
||||
@ -243,21 +269,10 @@ public:
|
||||
virtual const int *getFilters() const;
|
||||
virtual bool canPack();
|
||||
protected:
|
||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||
virtual const int *getCompressionMethods(int method, int level) const;
|
||||
virtual int buildLoader(const Filter *);
|
||||
virtual int buildLinuxLoader(
|
||||
upx_byte const *const proto, // assembly-only sections
|
||||
unsigned const szproto,
|
||||
upx_byte const *const fold, // linked assembly + C section
|
||||
unsigned const szfold,
|
||||
Filter const *ft
|
||||
);
|
||||
virtual void generateElfHdr(
|
||||
OutputFile *,
|
||||
void const *proto,
|
||||
unsigned const brka
|
||||
);
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
@ -275,21 +290,9 @@ public:
|
||||
virtual const int *getFilters() const;
|
||||
virtual bool canPack();
|
||||
protected:
|
||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||
virtual const int *getCompressionMethods(int method, int level) const;
|
||||
virtual int buildLoader(const Filter *);
|
||||
virtual int buildLinuxLoader(
|
||||
upx_byte const *const proto, // assembly-only sections
|
||||
unsigned const szproto,
|
||||
upx_byte const *const fold, // linked assembly + C section
|
||||
unsigned const szfold,
|
||||
Filter const *ft
|
||||
);
|
||||
virtual void generateElfHdr(
|
||||
OutputFile *,
|
||||
void const *proto,
|
||||
unsigned const brka
|
||||
);
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
@ -310,16 +313,9 @@ public:
|
||||
virtual void unpack(OutputFile *fo);
|
||||
|
||||
virtual bool canPack();
|
||||
virtual bool canUnpackVersion(int version) const
|
||||
{ return (version >= 11); }
|
||||
|
||||
protected:
|
||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||
virtual void pack4(OutputFile *, Filter &); // append pack header
|
||||
|
||||
virtual void patchLoader();
|
||||
virtual int buildLoader(const Filter *);
|
||||
virtual int buildLinuxLoader(
|
||||
upx_byte const *const proto, // assembly-only sections
|
||||
@ -328,30 +324,30 @@ protected:
|
||||
unsigned const szfold,
|
||||
Filter const *ft
|
||||
);
|
||||
virtual void generateElfHdr(
|
||||
OutputFile *,
|
||||
void const *proto,
|
||||
unsigned const brka
|
||||
);
|
||||
|
||||
Elf32_Ehdr ehdri; // from input file
|
||||
Elf32_Phdr *phdri; // for input file
|
||||
unsigned sz_phdrs; // sizeof Phdr[]
|
||||
|
||||
char *file_image; // if ET_DYN investigation
|
||||
Elf32_Dyn const *dynseg; // from PT_DYNAMIC
|
||||
unsigned int const *hashtab; // from DT_HASH
|
||||
char const *dynstr; // from DT_STRTAB
|
||||
Elf32_Sym const *dynsym; // from DT_SYMTAB
|
||||
|
||||
static unsigned elf_hash(char const *) /*const*/;
|
||||
virtual void const *elf_find_dynamic(unsigned) const;
|
||||
virtual Elf32_Sym const *elf_lookup(char const *) const;
|
||||
virtual unsigned elf_get_offset_from_address(unsigned) const;
|
||||
virtual unsigned find_LOAD_gap(Elf32_Phdr const *const phdri, unsigned const k,
|
||||
unsigned const e_phnum);
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
// linux/elfarm
|
||||
**************************************************************************/
|
||||
|
||||
class PackLinuxElf32arm : public PackLinuxElf32Le
|
||||
{
|
||||
typedef PackLinuxElf32Le super;
|
||||
public:
|
||||
PackLinuxElf32arm(InputFile *f);
|
||||
virtual ~PackLinuxElf32arm();
|
||||
virtual int getVersion() const { return 13; }
|
||||
virtual int getFormat() const { return UPX_F_LINUX_ELF32_ARM; }
|
||||
virtual const char *getName() const { return "linux/arm"; }
|
||||
virtual const int *getFilters() const;
|
||||
virtual int const *getCompressionMethods(int method, int level) const;
|
||||
|
||||
virtual bool canPack();
|
||||
protected:
|
||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||
virtual int buildLoader(const Filter *);
|
||||
};
|
||||
|
||||
#endif /*} already included */
|
||||
|
||||
|
||||
@ -215,11 +215,13 @@ static Packer* try_packers(InputFile *f, try_function func)
|
||||
if ((p = func(new PackLinuxElf32x86interp(f),f)) != NULL)
|
||||
return p;
|
||||
}
|
||||
if ((p = func(new PackLinuxElf32x86(f),f)) != NULL)
|
||||
return p;
|
||||
if ((p = func(new PackLinuxElf64amd(f),f)) != NULL)
|
||||
return p;
|
||||
if ((p = func(new PackLinuxElf32ppc(f),f)) != NULL)
|
||||
if ((p = func(new PackLinuxElf32arm(f),f)) != NULL)
|
||||
return p;
|
||||
if ((p = func(new PackLinuxElf32x86(f),f)) != NULL)
|
||||
if ((p = func(new PackLinuxElf32ppc(f),f)) != NULL)
|
||||
return p;
|
||||
if ((p = func(new PackLinuxI386sh(f),f)) != NULL)
|
||||
return p;
|
||||
|
||||
@ -48,6 +48,7 @@ STUBS = \
|
||||
l_lx_pti86.h fold_pti86.h \
|
||||
l_lx_elfppc32.h fold_elfppc32.h \
|
||||
l_lx_elf64amd.h fold_elf64amd.h \
|
||||
l_lx_elf32arm.h fold_elf32arm.h \
|
||||
l_mac_ppc32.h fold_machppc32.h \
|
||||
l_vmlinz.h l_vmlinx.h
|
||||
|
||||
@ -227,8 +228,9 @@ GCC_AMD64 += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||
GCC_ARM := arm-9tdmi-linux-gnu-gcc -march=armv4 -nostdinc -MMD
|
||||
GCC_ARM += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||
GCC_ARM_T := $(GCC_ARM) -march=armv4t
|
||||
OBJCOPY_ARM := arm-9tdmi-linux-gnu-objcopy
|
||||
|
||||
LD_ARM := arm-9tdmi-linux-gnu-ld
|
||||
OBJCOPY_LINUX_ARM := arm-9tdmi-linux-gnu-objcopy
|
||||
OBJSTRIP_LINUX_ARM := $(OBJCOPY_LINUX_ARM) -R .comment -R .note
|
||||
|
||||
# /***********************************************************************
|
||||
# // main targets
|
||||
@ -429,6 +431,13 @@ l_lx_elf64amd.h: l_lx_elf64amd.S amd_d_nrv2e.S
|
||||
$(LD_AMD64) -o $T.bin --oformat binary $T.o
|
||||
$(BIN2H) $T.bin linux_elf64amd_loader $@
|
||||
|
||||
l_lx_elf32arm.h: l_lx_elf32arm.S arm_nrv2e_d32.S
|
||||
$(GCC_ARM) -c $<
|
||||
$(OBJSTRIP_LINUX_ARM) $T.o
|
||||
$(LD_ARM) -o $T.out $T.o
|
||||
$(OBJCOPY_LINUX_ARM) --only-section .text -O binary $T.out $T.bin
|
||||
$(BIN2H) $T.bin linux_elf32arm_loader $@
|
||||
|
||||
l_lx_elf.o: l_lx_elf.c linux.hh $(MAKEFILE_DEPS)
|
||||
$(CC_LINUX_I386) -c $<
|
||||
$(OBJSTRIP_LINUX_I386) $@
|
||||
@ -469,6 +478,10 @@ a_lx_elf64amd.o: a_lx_elf64.c $(MAKEFILE_DEPS)
|
||||
$(GCC_AMD64) -c -Os -fno-exceptions -fno-asynchronous-unwind-tables -o $@ $<
|
||||
$(OBJSTRIP_AMD64) $@
|
||||
|
||||
a_lx_elf32arm.o: l_lx_elf.c $(MAKEFILE_DEPS)
|
||||
$(GCC_ARM) -c -Os -fno-exceptions -fno-asynchronous-unwind-tables -o $@ $<
|
||||
$(OBJSTRIP_LINUX_ARM) $@
|
||||
|
||||
fold_elfppc32.o: fold_elfppc32.S ppc_bxx.S $(MAKEFILE_DEPS)
|
||||
$(GCC_PPC32) -c $<
|
||||
$(OBJSTRIP_PPC32) $@
|
||||
@ -477,6 +490,10 @@ fold_elf64amd.o: fold_elf64amd.S amd_bxx.S $(MAKEFILE_DEPS)
|
||||
$(GCC_AMD64) -c $<
|
||||
$(OBJSTRIP_AMD64) $@
|
||||
|
||||
fold_elf32arm.o: fold_elf32arm.S $(MAKEFILE_DEPS)
|
||||
$(GCC_ARM) -c $<
|
||||
$(OBJSTRIP_LINUX_ARM) $@
|
||||
|
||||
fold_elfppc32.h: m_lx_elfppc32.o fold_elfppc32.o l_lx_elfppc32.lds
|
||||
$(LD_PPC32) -T $(srcdir)/l_lx_elfppc32.lds -Map $T.map -o $T.bin --strip-all \
|
||||
fold_elfppc32.o m_lx_elfppc32.o
|
||||
@ -488,6 +505,12 @@ fold_elf64amd.h: a_lx_elf64amd.o fold_elf64amd.o l_lx_elf64amd.lds amd_bxx.S
|
||||
$(STRIPELF_LINUX_I386) $T.bin
|
||||
$(BIN2H) $T.bin linux_elf64amd_fold $@
|
||||
|
||||
fold_elf32arm.h: a_lx_elf32arm.o fold_elf32arm.o l_lx_elf32arm.lds amd_bxx.S
|
||||
$(LD_ARM) -T $(srcdir)/l_lx_elf32arm.lds -Map $T.map -o $T.bin --strip-all \
|
||||
fold_elf32arm.o a_lx_elf32arm.o
|
||||
$(STRIPELF_LINUX_I386) $T.bin
|
||||
$(BIN2H) $T.bin linux_elf32arm_fold $@
|
||||
|
||||
fold_exec86.o: fold_exec86.asm
|
||||
$(NASM) -f elf -o $@ $<
|
||||
$(OBJSTRIP_LINUX_I386) $@
|
||||
@ -555,12 +578,12 @@ upxd: l_lx_sep.o l_lx_sep86.asm
|
||||
|
||||
l_armpea.h: l_armpea.S armv4_n2e_d8.S $(MAKEFILE_LIST)
|
||||
$(GCC_ARM) $T.S -o $T.out -nostdlib
|
||||
$(OBJCOPY_ARM) --only-section .text -O binary $T.out $T.bin
|
||||
$(OBJCOPY_LINUX_ARM) --only-section .text -O binary $T.out $T.bin
|
||||
$(BIN2H) $T.bin nrv_loader_arm $@
|
||||
|
||||
l_armpet.h: l_armpet.S arm_nrv2e_d8.S arm_nrv2b_d8.S $(MAKEFILE_LIST)
|
||||
$(GCC_ARM_T) $T.S -o $T.out -nostdlib
|
||||
$(OBJCOPY_ARM) --only-section .text -O binary $T.out $T.bin
|
||||
$(OBJCOPY_LINUX_ARM) --only-section .text -O binary $T.out $T.bin
|
||||
$(BIN2H) $T.bin nrv_loader_thumb $@
|
||||
|
||||
# /***********************************************************************
|
||||
|
||||
159
src/stub/fold_elf32arm.S
Normal file
159
src/stub/fold_elf32arm.S
Normal file
@ -0,0 +1,159 @@
|
||||
@ fold_elfarm.asm -- linkage to C code to process Elf binary
|
||||
@
|
||||
@ This file is part of the UPX executable compressor.
|
||||
@
|
||||
@ Copyright (C) 2000-2006 John F. Reiser
|
||||
@ All Rights Reserved.
|
||||
@
|
||||
@ UPX and the UCL library are free software; you can redistribute them
|
||||
@ and/or modify them under the terms of the GNU General Public License as
|
||||
@ published by the Free Software Foundation; either version 2 of
|
||||
@ the License, or (at your option) any later version.
|
||||
@
|
||||
@ This program is distributed in the hope that it will be useful,
|
||||
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@ GNU General Public License for more details.
|
||||
@
|
||||
@ You should have received a copy of the GNU General Public License
|
||||
@ along with this program; see the file COPYING.
|
||||
@ If not, write to the Free Software Foundation, Inc.,
|
||||
@ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
@
|
||||
@ Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
@ <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||
@
|
||||
@ John F. Reiser
|
||||
@ <jreiser@users.sourceforge.net>
|
||||
@
|
||||
|
||||
sz_Elf32_Ehdr = 13*4
|
||||
sz_Elf32_Phdr = 8*4
|
||||
sz_l_info = 12
|
||||
sz_p_info = 12
|
||||
sz_b_info = 12
|
||||
sz_unc= 0
|
||||
sz_cpr= 4
|
||||
b_method= 8
|
||||
|
||||
@@ control just falls through, after this part and compiled C code
|
||||
@@ are uncompressed.
|
||||
|
||||
#define OVERHEAD 2048
|
||||
#define MAX_ELF_HDR 512
|
||||
|
||||
fold_begin:
|
||||
/* In:
|
||||
r10= &b_info of first compressed block (after move)
|
||||
r9= total size of compressed data
|
||||
r5= f_decompress
|
||||
sp/ ADRU,LENU,sz_unc,argc,argv...
|
||||
*/
|
||||
ldr r3,[sp,#3*4] @ argc
|
||||
add r3,sp,r3,lsl #2 @ skip argv
|
||||
add r3,r3,#3*4 +4 +4 @ skip ADRU,LENU,sz_unc, argc, env_end
|
||||
.Lenv:
|
||||
ldr r0,[r3],#4 @ skip env
|
||||
cmp r0,#0
|
||||
bne .Lenv
|
||||
/* r3= &Elf32_auxv_t */
|
||||
mov r2,r3
|
||||
.Laux:
|
||||
ldr r0,[r2],#2*4 @ .a_type
|
||||
cmp r0,#0
|
||||
bne .Laux
|
||||
str r2,[sp,#2*4] @ clobber sz_unc with 1+ &Elf32_auxv_t[AT_NULL@.a_type]
|
||||
|
||||
sub sp,sp,#MAX_ELF_HDR + OVERHEAD @ alloca
|
||||
mov r4,r9 @ total size of compressed data
|
||||
ldr r9,[r10,#sz_cpr] @ xi.size of ELF headers
|
||||
mov r8,sp @ xo.ptr
|
||||
ldr r7,[r10,#sz_unc] @ xo.size
|
||||
adr r6,f_unfilter
|
||||
add r9,r9,#sz_b_info @ for unpackExtent
|
||||
mov r11,#0 @ dynbase for ET_EXEC; FIXME for ET_DYN
|
||||
stmdb sp!,{r3,r4,r5,r6,r7,r8,r9,r10,r11}
|
||||
ldmia sp!,{r0,r1,r2,r3}
|
||||
bl upx_main
|
||||
mov lr,r0 @ entry address
|
||||
add sp,sp,#(9-4)*4
|
||||
add sp,sp,#MAX_ELF_HDR + OVERHEAD @ un-alloca
|
||||
ldmia sp!,{r0,r1,r2} @ ADRU,LENU,1+ &Elf32_auxv_t[AT_NULL@.a_type]
|
||||
ldr pc,[r2,#4 -2*4] @ Elf32_auxv_t[AT_NULL@.a_type].a_val
|
||||
|
||||
f_unfilter: @ (char *ptr, uint len, uint cto, uint fid)
|
||||
ptr .req r0
|
||||
len .req r1
|
||||
cto .req r2 @ unused
|
||||
fid .req r3
|
||||
|
||||
tmp .req fid @ disjoint lifetimes
|
||||
|
||||
and fid,fid,#0xff
|
||||
cmp fid,#0x50 @ last use of fid
|
||||
movne pc,lr @ no-op if not filter 0x50
|
||||
|
||||
movs len,len,lsr #2 @ word count
|
||||
cmpne ptr,#0
|
||||
moveq pc,lr @ no-op if either len or ptr is 0
|
||||
|
||||
top_unf:
|
||||
subs len,len,#1 @ condition code holds until tst_unf
|
||||
ldr r3,[ptr,len,lsl #2]
|
||||
and tmp,r3,#0x0f<<24
|
||||
cmp tmp, #0x0b<<24
|
||||
bne tst_unf
|
||||
and tmp,r3,#0xff<<24
|
||||
sub r3,r3,len @ convert to word-relative
|
||||
bic r3,r3, #0xff<<24
|
||||
orr r3,r3,tmp
|
||||
str r3,[ptr,len,lsl #2]
|
||||
tst_unf:
|
||||
bne top_unf
|
||||
mov pc,lr
|
||||
|
||||
.unreq ptr
|
||||
.unreq len
|
||||
.unreq cto
|
||||
.unreq fid
|
||||
|
||||
.globl exit
|
||||
exit:
|
||||
swi 0x00900001
|
||||
|
||||
.globl read
|
||||
read:
|
||||
swi 0x00900003; mov pc,lr
|
||||
|
||||
.globl open
|
||||
open:
|
||||
swi 0x00900005; mov pc,lr
|
||||
|
||||
.globl close
|
||||
close:
|
||||
swi 0x00900006; mov pc,lr
|
||||
|
||||
.globl brk
|
||||
brk:
|
||||
swi 0x0090002d; mov pc,lr
|
||||
|
||||
.globl munmap
|
||||
munmap:
|
||||
swi 0x0090005b; mov pc,lr
|
||||
|
||||
.globl mprotect
|
||||
mprotect:
|
||||
swi 0x0090007d; mov pc,lr
|
||||
|
||||
.globl mmap
|
||||
mmap:
|
||||
str r5,[sp,#-4]!; ldr r5,[sp,#4+4]
|
||||
str r4,[sp,#-4]!; ldr r4,[sp,#4+4]
|
||||
mov r5,r5,lsr #12 @ convert to page number
|
||||
swi 0x009000c0 @ mmap64
|
||||
ldr r4,[sp],#4
|
||||
ldr r5,[sp],#4
|
||||
mov pc,lr
|
||||
|
||||
@ vi:ts=8:et:nowrap
|
||||
|
||||
165
src/stub/fold_elf32arm.h
Normal file
165
src/stub/fold_elf32arm.h
Normal file
@ -0,0 +1,165 @@
|
||||
/* fold_elf32arm.h -- created from fold_elf32arm.bin, 2076 (0x81c) bytes
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2006 Laszlo Molnar
|
||||
Copyright (C) 2000-2006 John F. Reiser
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
and/or modify them under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
|
||||
#define LINUX_ELF32ARM_FOLD_SIZE 2076
|
||||
#define LINUX_ELF32ARM_FOLD_ADLER32 0x40fd5272
|
||||
#define LINUX_ELF32ARM_FOLD_CRC32 0x0e817a00
|
||||
|
||||
unsigned char linux_elf32arm_fold[2076] = {
|
||||
127, 69, 76, 70, 1, 1, 1, 97, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */
|
||||
2, 0, 40, 0, 1, 0, 0, 0,128,128, 0, 0, 52, 0, 0, 0, /* 0x 10 */
|
||||
0, 0, 0, 0, 2, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,128, 0, 0, /* 0x 30 */
|
||||
0,128, 0, 0, 28, 8, 0, 0, 28, 8, 0, 0, 5, 0, 0, 0, /* 0x 40 */
|
||||
0,128, 0, 0, 1, 0, 0, 0, 28, 8, 0, 0, 28,136, 0, 0, /* 0x 50 */
|
||||
28,136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, /* 0x 60 */
|
||||
0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
|
||||
12, 48,157,229, 3, 49,141,224, 20, 48,131,226, 4, 0,147,228, /* 0x 80 */
|
||||
0, 0, 80,227,252,255,255, 26, 3, 32,160,225, 8, 0,146,228, /* 0x 90 */
|
||||
0, 0, 80,227,252,255,255, 26, 8, 32,141,229, 10,220, 77,226, /* 0x a0 */
|
||||
9, 64,160,225, 4,144,154,229, 13,128,160,225, 0,112,154,229, /* 0x b0 */
|
||||
36, 96,143,226, 12,144,137,226, 0,176,160,227,248, 15, 45,233, /* 0x c0 */
|
||||
15, 0,189,232,122, 1, 0,235, 0,224,160,225, 20,208,141,226, /* 0x d0 */
|
||||
10,220,141,226, 7, 0,189,232, 4,240, 18,229,255, 48, 3,226, /* 0x e0 */
|
||||
80, 0, 83,227, 14,240,160, 17, 33, 17,176,225, 0, 0, 80, 19, /* 0x f0 */
|
||||
14,240,160, 1, 1, 16, 81,226, 1, 49,144,231, 15, 52, 3,226, /* 0x 100 */
|
||||
11, 4, 83,227, 4, 0, 0, 26,255, 52, 3,226, 1, 48, 67,224, /* 0x 110 */
|
||||
255, 52,195,227, 3, 48,131,225, 1, 49,128,231,244,255,255, 26, /* 0x 120 */
|
||||
14,240,160,225, 1, 0,144,239, 3, 0,144,239, 14,240,160,225, /* 0x 130 */
|
||||
5, 0,144,239, 14,240,160,225, 6, 0,144,239, 14,240,160,225, /* 0x 140 */
|
||||
45, 0,144,239, 14,240,160,225, 91, 0,144,239, 14,240,160,225, /* 0x 150 */
|
||||
125, 0,144,239, 14,240,160,225, 4, 80, 45,229, 8, 80,157,229, /* 0x 160 */
|
||||
4, 64, 45,229, 8, 64,157,229, 37, 86,160,225,192, 0,144,239, /* 0x 170 */
|
||||
4, 64,157,228, 4, 80,157,228, 14,240,160,225, 4,224, 45,229, /* 0x 180 */
|
||||
0, 48,144,229, 2, 0, 83,225, 2,192,160,225, 4,224,144,229, /* 0x 190 */
|
||||
127, 0,160, 51,226,255,255, 59, 1, 32, 66,226, 1, 0,114,227, /* 0x 1a0 */
|
||||
4, 0, 0, 10, 1, 48,222,228, 1, 32, 66,226, 1, 48,193,228, /* 0x 1b0 */
|
||||
1, 0,114,227,249,255,255,234, 4, 32,144,229, 0, 48,144,229, /* 0x 1c0 */
|
||||
12, 32,130,224, 3, 48,108,224, 0, 48,128,229, 4, 32,128,229, /* 0x 1d0 */
|
||||
4,240,157,228,240, 64, 45,233, 1, 64,160,225, 0, 16,145,229, /* 0x 1e0 */
|
||||
20,208, 77,226, 0, 0, 81,227, 0, 80,160,225, 2,112,160,225, /* 0x 1f0 */
|
||||
3, 96,160,225, 70, 0, 0, 10, 8, 16,141,226, 12, 32,160,227, /* 0x 200 */
|
||||
5, 0,160,225,220,255,255,235, 8, 16,157,229, 0, 0, 81,227, /* 0x 210 */
|
||||
12, 32,157,229, 6, 0, 0, 26,252, 48,159,229, 3, 0, 82,225, /* 0x 220 */
|
||||
5, 0, 0, 26, 0, 48,149,229, 0, 0, 83,227, 56, 0, 0, 10, /* 0x 230 */
|
||||
1, 0, 0,234, 0, 0, 82,227, 1, 0, 0, 26,127, 0,160,227, /* 0x 240 */
|
||||
183,255,255,235, 1, 0, 82,225,251,255,255,138, 0, 48,148,229, /* 0x 250 */
|
||||
3, 0, 81,225,248,255,255,138, 1, 0, 82,225, 4, 48,148,229, /* 0x 260 */
|
||||
33, 0, 0, 42, 16,192,221,229, 4, 0,149,229, 2, 16,160,225, /* 0x 270 */
|
||||
0,192,141,229, 3, 32,160,225, 4, 48,141,226, 15,224,160,225, /* 0x 280 */
|
||||
7,240,160,225, 0, 0, 80,227,235,255,255, 26, 10, 0,157,233, /* 0x 290 */
|
||||
3, 0, 81,225,232,255,255, 26, 17, 32,221,229, 0, 0, 82,227, /* 0x 2a0 */
|
||||
0, 0, 86, 19, 9, 0, 0, 10, 2, 12, 81,227, 2, 0, 0,138, /* 0x 2b0 */
|
||||
0, 48,148,229, 1, 0, 83,225, 4, 0, 0, 26, 2, 48,160,225, /* 0x 2c0 */
|
||||
4, 0,148,229, 18, 32,221,229, 15,224,160,225, 6,240,160,225, /* 0x 2d0 */
|
||||
4, 48,149,229, 12, 16,157,229, 0, 32,149,229, 1, 48,131,224, /* 0x 2e0 */
|
||||
2, 32, 97,224, 12, 0,133,232, 2, 0, 0,234, 3, 16,160,225, /* 0x 2f0 */
|
||||
5, 0,160,225,160,255,255,235, 8, 16,157,229, 12, 0,148,232, /* 0x 300 */
|
||||
2, 32, 97,224, 1, 48,131,224, 0, 0, 82,227, 12, 0,132,232, /* 0x 310 */
|
||||
183,255,255,234, 20,208,141,226,240,128,189,232, 85, 80, 88, 33, /* 0x 320 */
|
||||
0, 0, 80,227, 14,240,160, 1, 1, 0, 16,227, 14,240,160, 17, /* 0x 330 */
|
||||
0, 48,144,229, 1, 0, 83,225, 6, 0, 0, 10, 1, 0, 83,227, /* 0x 340 */
|
||||
0, 48,160, 19, 1, 48,160, 3, 0, 0, 81,227, 0, 48,160, 3, /* 0x 350 */
|
||||
0, 0, 83,227, 1, 0, 0, 10, 6, 0,128,232, 14,240,160,225, /* 0x 360 */
|
||||
8, 0,128,226,241,255,255,234,240, 79, 45,233, 40,208, 77,226, /* 0x 370 */
|
||||
1,144,160,225, 28,192,145,229, 2,176,160,225,176, 17,209,225, /* 0x 380 */
|
||||
80, 32,157,229,188,226,217,225, 2, 0, 81,227, 12,112,137,224, /* 0x 390 */
|
||||
24, 0,141,229, 20, 48,141,229, 16, 32,141,229, 50,128,160, 3, /* 0x 3a0 */
|
||||
34,128,160, 19, 7, 16,160,225, 1,224, 94,226, 0, 96,224,227, /* 0x 3b0 */
|
||||
0, 80,160,227, 12, 0, 0, 74, 0, 48,145,229, 1, 0, 83,227, /* 0x 3c0 */
|
||||
6, 0, 0, 26, 8, 32,145,229, 20, 48,145,229, 2, 48,131,224, /* 0x 3d0 */
|
||||
3, 0, 85,225, 3, 80,160, 49, 2, 0, 86,225, 2, 96,160, 33, /* 0x 3e0 */
|
||||
1,224, 94,226, 32, 16,129,226,241,255,255,234,255,110,198,227, /* 0x 3f0 */
|
||||
15, 96,198,227, 5, 48,102,224,255, 62,131,226, 15, 48,131,226, /* 0x 400 */
|
||||
255, 94,195,227, 0, 64,160,227, 15, 80,197,227, 8, 48,160,225, /* 0x 410 */
|
||||
6, 0,160,225, 0,192,224,227, 5, 16,160,225, 4, 32,160,225, /* 0x 420 */
|
||||
0,192,141,229, 4, 64,141,229, 74,255,255,235,188, 50,217,225, /* 0x 430 */
|
||||
3, 0, 84,225, 5, 48,128,224, 12, 64,141,229, 36, 48,141,229, /* 0x 440 */
|
||||
0, 96,102,224,133, 0, 0,170, 0, 48,151,229, 6, 0, 83,227, /* 0x 450 */
|
||||
5, 0, 0, 26, 8, 32,151,229, 20, 0,157,229, 6, 32,130,224, /* 0x 460 */
|
||||
3, 16,160,227,173,255,255,235,117, 0, 0,234, 1, 0, 83,227, /* 0x 470 */
|
||||
115, 0, 0, 26, 24, 48,151,229, 8, 16,151,229, 7, 48, 3,226, /* 0x 480 */
|
||||
32, 34,159,229, 6, 16,129,224, 3, 49,160,225, 16, 0,151,229, /* 0x 490 */
|
||||
50, 35,160,225, 1, 74,160,225, 20, 48,151,229, 0, 0, 91,227, /* 0x 4a0 */
|
||||
4,192,151,229, 36, 74,160,225, 3, 48,129,224, 1, 80,100,224, /* 0x 4b0 */
|
||||
24,224,157, 5, 7,128, 2,226, 4,160,128,224, 2, 32,160, 19, /* 0x 4c0 */
|
||||
0, 32,160, 3, 8, 48,141,229, 0,224,224, 19, 28, 0,141,229, /* 0x 4d0 */
|
||||
32, 16,141,229, 18, 48,160, 3, 50, 48,160, 19, 12,192,100,224, /* 0x 4e0 */
|
||||
8, 32,130,225, 5, 0,160,225, 10, 16,160,225, 0,224,141,229, /* 0x 4f0 */
|
||||
4,192,141,229, 23,255,255,235, 0, 0, 85,225, 62, 0, 0, 26, /* 0x 500 */
|
||||
0, 0, 91,227, 6, 0, 0, 10, 16, 32,157,229, 40, 49,176,225, /* 0x 510 */
|
||||
2, 48,160, 17, 28, 16,141,226, 11, 0,160,225, 24, 32,157,229, /* 0x 520 */
|
||||
43,255,255,235, 0, 48,106,226, 3, 74,160,225, 2, 0, 24,227, /* 0x 530 */
|
||||
36, 74,160,225, 7, 0, 0, 10, 0, 0, 84,227, 10, 16,133,224, /* 0x 540 */
|
||||
4, 32,160,225, 3, 0, 0, 10, 0, 48,160,227, 1, 32, 82,226, /* 0x 550 */
|
||||
1, 48,193,228,251,255,255, 26, 0, 0, 91,227, 40, 0, 0, 10, /* 0x 560 */
|
||||
0, 48,151,229, 1, 0, 83,227, 29, 0, 0, 26, 24, 48,151,229, /* 0x 570 */
|
||||
1, 0, 19,227, 26, 0, 0, 10, 16, 32,135,226, 12, 0,146,232, /* 0x 580 */
|
||||
8, 16,151,229, 2, 0, 83,225, 1, 48,131,224, 6, 32,131,224, /* 0x 590 */
|
||||
4, 0, 0, 26, 0, 48, 98,226, 3, 58,160,225, 35, 58,160,225, /* 0x 5a0 */
|
||||
7, 0, 83,227, 6, 0, 0,138, 4, 32,151,229,134, 48,134,224, /* 0x 5b0 */
|
||||
3, 49,134,224, 3, 49,129,224, 0, 0, 82,227, 8, 32,131,226, /* 0x 5c0 */
|
||||
3, 0, 0, 26,224, 48,159,229, 0, 48,130,229,220, 48,159,229, /* 0x 5d0 */
|
||||
4, 48,130,229, 0, 0, 82,227, 20, 0,157, 21, 0, 16,160, 19, /* 0x 5e0 */
|
||||
78,255,255, 27, 5, 0,160,225, 10, 16,160,225, 8, 32,160,225, /* 0x 5f0 */
|
||||
214,254,255,235, 0, 0, 80,227, 1, 0, 0, 10,127, 0,160,227, /* 0x 600 */
|
||||
199,254,255,235, 4, 48,138,224, 3, 80,133,224, 8, 48,157,229, /* 0x 610 */
|
||||
3, 0, 85,225, 10, 0, 0, 42, 0,192,224,227, 3, 16,101,224, /* 0x 620 */
|
||||
0,192,141,229, 8, 32,160,225, 1,192,140,226, 5, 0,160,225, /* 0x 630 */
|
||||
50, 48,160,227, 4,192,141,229,198,254,255,235, 0, 0, 85,225, /* 0x 640 */
|
||||
237,255,255, 26, 12, 32,157,229,188, 50,217,225, 1, 32,130,226, /* 0x 650 */
|
||||
3, 0, 82,225, 32,112,135,226, 12, 32,141,229,120,255,255,234, /* 0x 660 */
|
||||
0, 0, 91,227, 4, 0, 0, 26, 24, 0,157,229,177,254,255,235, /* 0x 670 */
|
||||
0, 0, 80,227, 4, 0, 0, 10,223,255,255,234,176, 49,217,225, /* 0x 680 */
|
||||
3, 0, 83,227, 36, 0,157, 21,172,254,255, 27, 76, 48,157,229, /* 0x 690 */
|
||||
0, 0, 83,227, 0, 96,131, 21, 24, 0,153,229, 6, 0,128,224, /* 0x 6a0 */
|
||||
40,208,141,226,240,143,189,232, 64, 98, 81,115, 91, 0,144,239, /* 0x 6b0 */
|
||||
14,240,160,225,240, 71, 45,233, 12,208, 77,226, 44,192,141,226, /* 0x 6c0 */
|
||||
52,112,141,226, 0, 80,160,225, 1, 96,160,225, 3,160,160,225, /* 0x 6d0 */
|
||||
12, 16,160,225, 0, 48,160,227, 7, 0,160,225, 4,144,156,229, /* 0x 6e0 */
|
||||
2,128,160,225, 52, 64,157,229,185,254,255,235, 56, 48,157,229, /* 0x 6f0 */
|
||||
5, 0,160,225, 3, 48,100,224, 5, 16,160,227,188, 34,217,225, /* 0x 700 */
|
||||
56, 48,141,229, 52, 96,141,229, 4,255,255,235, 52, 96,137,226, /* 0x 710 */
|
||||
5, 0,160,225, 4, 16,160,227,186, 34,217,225,255,254,255,235, /* 0x 720 */
|
||||
8, 48,150,229, 60, 32,157,229, 3, 32,130,224, 52, 32,130,226, /* 0x 730 */
|
||||
5, 0,160,225, 3, 16,160,227,248,254,255,235, 8,192,141,226, /* 0x 740 */
|
||||
7, 32,160,225, 9, 16,160,225, 5, 48,160,225, 8, 0,160,225, /* 0x 750 */
|
||||
0,192,141,229, 4,160,141,229, 2,255,255,235, 0, 64,160,225, /* 0x 760 */
|
||||
9, 16,160,227, 4, 32,160,225, 5, 0,160,225,235,254,255,235, /* 0x 770 */
|
||||
188, 18,217,225, 0, 32,160,227, 1, 0, 82,225, 31, 0, 0,170, /* 0x 780 */
|
||||
0, 48,150,229, 3, 0, 83,227, 1, 32,130,226, 24, 0, 0, 26, /* 0x 790 */
|
||||
8, 48,150,229, 8, 0,157,229, 0, 16,160,227, 0, 0,131,224, /* 0x 7a0 */
|
||||
1, 32,160,225, 97,254,255,235, 0, 64, 80,226, 4, 0, 0,186, /* 0x 7b0 */
|
||||
9, 16,160,225, 2, 44,160,227, 90,254,255,235, 2, 12, 80,227, /* 0x 7c0 */
|
||||
1, 0, 0, 10,127, 0,160,227, 85,254,255,235, 0,192,160,227, /* 0x 7d0 */
|
||||
4, 0,160,225, 12, 32,160,225, 9, 16,160,225, 12, 48,160,225, /* 0x 7e0 */
|
||||
0,192,141,229, 4,192,141,229,222,254,255,235, 0, 64,160,225, /* 0x 7f0 */
|
||||
2, 0, 0,234, 1, 0, 82,225, 32, 96,134,226,222,255,255,234, /* 0x 800 */
|
||||
4, 0,160,225, 12,208,141,226,240,135,189,232 /* 0x 810 */
|
||||
};
|
||||
@ -1,4 +1,4 @@
|
||||
/* fold_elf86.h -- created from fold_elf86.bin, 1607 (0x647) bytes
|
||||
/* fold_elf86.h -- created from fold_elf86.bin, 1622 (0x656) bytes
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
@ -27,18 +27,18 @@
|
||||
*/
|
||||
|
||||
|
||||
#define LINUX_I386ELF_FOLD_SIZE 1607
|
||||
#define LINUX_I386ELF_FOLD_ADLER32 0xdf50b4ab
|
||||
#define LINUX_I386ELF_FOLD_CRC32 0x537b9a31
|
||||
#define LINUX_I386ELF_FOLD_SIZE 1622
|
||||
#define LINUX_I386ELF_FOLD_ADLER32 0x0526bd6c
|
||||
#define LINUX_I386ELF_FOLD_CRC32 0x143cc952
|
||||
|
||||
unsigned char linux_i386elf_fold[1607] = {
|
||||
unsigned char linux_i386elf_fold[1622] = {
|
||||
127, 69, 76, 70, 1, 1, 1, 0, 76,105,110,117,120, 0, 0, 0, /* 0x 0 */
|
||||
2, 0, 3, 0, 1, 0, 0, 0,128, 16,192, 0, 52, 0, 0, 0, /* 0x 10 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */
|
||||
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 16,192, 0, /* 0x 30 */
|
||||
0, 16,192, 0, 71, 6, 0, 0, 72, 6, 0, 0, 5, 0, 0, 0, /* 0x 40 */
|
||||
0, 16, 0, 0, 1, 0, 0, 0, 71, 6, 0, 0, 72, 22,192, 0, /* 0x 50 */
|
||||
72, 22,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, /* 0x 60 */
|
||||
0, 16,192, 0, 86, 6, 0, 0, 88, 6, 0, 0, 5, 0, 0, 0, /* 0x 40 */
|
||||
0, 16, 0, 0, 1, 0, 0, 0, 86, 6, 0, 0, 88, 22,192, 0, /* 0x 50 */
|
||||
88, 22,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, /* 0x 60 */
|
||||
0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 70 */
|
||||
41,201,186,120, 2, 0, 0,137,230,137,231,232,121, 0, 0, 0, /* 0x 80 */
|
||||
137,230,209,234, 25,192, 41,193,141, 36,196,133,210,117,243,137, /* 0x 90 */
|
||||
@ -46,7 +46,7 @@ unsigned char linux_i386elf_fold[1607] = {
|
||||
141,148, 26,255, 31, 0, 0,129,226, 0,240,255,255, 82, 41,192, /* 0x b0 */
|
||||
102,131,123, 16, 3,117, 1,146, 80,139,115, 24,141,131,140, 0, /* 0x c0 */
|
||||
0, 0, 41,198,139, 24,139, 72, 4,131,193, 12,141, 84, 36, 12, /* 0x d0 */
|
||||
96, 71,232, 90, 4, 0, 0,131,196, 36, 89, 91,129,196, 0, 10, /* 0x e0 */
|
||||
96, 71,232, 92, 4, 0, 0,131,196, 36, 89, 91,129,196, 0, 10, /* 0x e0 */
|
||||
0, 0, 80, 79, 41,192, 60,175,175,117,252, 80, 80, 80, 80, 80, /* 0x f0 */
|
||||
80, 80, 80, 41,217,176, 91,255, 39,173,171,133,192,117,250,173, /* 0x 100 */
|
||||
171,133,192,117,250, 87,173,171,131,248, 32,115, 3, 15,179,194, /* 0x 110 */
|
||||
@ -71,66 +71,67 @@ unsigned char linux_i386elf_fold[1607] = {
|
||||
66,255,255,255,141,101,244, 91, 94, 95,201,195,133,192, 83,137, /* 0x 240 */
|
||||
211,116, 29,168, 1,117, 25,139, 16, 57,218,116, 7, 74,117, 11, /* 0x 250 */
|
||||
133,219,116, 7,137, 24,137, 72, 4,235, 5,131,192, 8,235,231, /* 0x 260 */
|
||||
91,195, 85,137,229, 87, 86, 83,131,236, 64,137, 85,224,139, 77, /* 0x 270 */
|
||||
224,137, 69,228,139, 85, 12, 3, 73, 28,139, 69, 8,137, 85,216, /* 0x 280 */
|
||||
139, 93,224,139, 85,224,137, 69,220, 49,192,102,131,123, 16, 2, /* 0x 290 */
|
||||
137, 77,212,137,203, 15,183, 74, 44, 15,148,192,131,207,255,193, /* 0x 2a0 */
|
||||
224, 4,137,202, 49,246,131,192, 34, 74,120, 28,131, 59, 1,117, /* 0x 2b0 */
|
||||
18,139, 83, 8, 57,250,115, 2,137,215, 3, 83, 20, 57,214,115, /* 0x 2c0 */
|
||||
2,137,214,131,195, 32,226,228,137,251,106, 0,129,227, 0,240, /* 0x 2d0 */
|
||||
255,255,106,255, 41,222, 80,129,198,255, 15, 0, 0,106, 0,129, /* 0x 2e0 */
|
||||
230, 0,240,255,255, 86, 83,232, 55,254,255,255,139, 77,224,141, /* 0x 2f0 */
|
||||
52, 48,131,196, 24, 41,216,102,131,121, 44, 0,137,117,240,137, /* 0x 300 */
|
||||
69,208,199, 69,204, 0, 0, 0, 0, 15,132,218, 1, 0, 0,139, /* 0x 310 */
|
||||
93,212,139, 3,131,248, 6,117, 24,139, 77,208,186, 3, 0, 0, /* 0x 320 */
|
||||
0, 3, 75, 8,139, 69,216,232, 16,255,255,255,233,161, 1, 0, /* 0x 330 */
|
||||
0, 72, 15,133,154, 1, 0, 0,139, 69,212,199, 69,200, 64, 98, /* 0x 340 */
|
||||
81,115,139, 85,212,139, 72, 24,139, 90, 20,131,225, 7,193,225, /* 0x 350 */
|
||||
2,211,109,200,139, 72, 16,139, 69,208, 3, 66, 8,137, 77,232, /* 0x 360 */
|
||||
131,101,200, 7,137,194, 1,195,129,226,255, 15, 0, 0,137,199, /* 0x 370 */
|
||||
141, 52, 17,139, 77,212,137, 69,236, 41,215,139, 65, 4,137, 93, /* 0x 380 */
|
||||
196, 41,208,131,125,220, 0, 80,139, 69,228,116, 3,131,200,255, /* 0x 390 */
|
||||
131,125,220, 1, 80, 25,192,131,224,224,131,192, 50,131,125,220, /* 0x 3a0 */
|
||||
0, 80,139, 69,200,116, 3,131,200, 2,131,125,220, 0, 80,137, /* 0x 3b0 */
|
||||
240,116, 3,141, 70, 3, 80, 87,232,102,253,255,255,131,196, 24, /* 0x 3c0 */
|
||||
57,199, 15,133,187, 0, 0, 0,131,125,220, 0,116, 31, 49,192, /* 0x 3d0 */
|
||||
246, 69,200, 4,116, 6,139, 69,228,131,192, 2, 80,139, 69,220, /* 0x 3e0 */
|
||||
255,117,228,141, 85,232,232,114,253,255,255, 88, 90,137,243,247, /* 0x 3f0 */
|
||||
219,129,227,255, 15, 0, 0,246, 69,200, 2,137, 93,192,116, 15, /* 0x 400 */
|
||||
133,219,141, 4, 55,116, 8,137,217,198, 0, 0, 64,226,250,131, /* 0x 410 */
|
||||
125,220, 0,116,120,139, 69,212,131, 56, 1,117, 86,246, 64, 24, /* 0x 420 */
|
||||
1,116, 80,139, 80, 20,139, 88, 8,141, 12, 26, 3, 77,208, 59, /* 0x 430 */
|
||||
80, 16,117, 14,137,200,247,216, 37,255, 15, 0, 0,131,248, 3, /* 0x 440 */
|
||||
119, 17,139, 85,212,107, 69,208, 52,131,122, 4, 0,141, 76, 3, /* 0x 450 */
|
||||
12,117, 15,139, 1, 61,205,128, 97,195,116, 6,199, 1,205,128, /* 0x 460 */
|
||||
97,195,133,201,116, 13,139, 69,216, 49,210,131,224,254,232,201, /* 0x 470 */
|
||||
253,255,255,137,251,137,241,139, 85,200,106,125, 88,205,128,133, /* 0x 480 */
|
||||
192,116, 10,106,127, 91,106, 1, 88,205,128,235,254,139, 85,192, /* 0x 490 */
|
||||
141, 4, 22,141, 28, 7, 59, 93,196,115, 30,106, 0,106,255,106, /* 0x 4a0 */
|
||||
50,255,117,200, 41, 93,196,255,117,196, 83,232,115,252,255,255, /* 0x 4b0 */
|
||||
131,196, 24, 57,195,116, 27,235,202,131,125,220, 0,116, 19,141, /* 0x 4c0 */
|
||||
78, 3,129,225,255, 15, 0, 0,131,249, 3,119, 5,106, 91, 88, /* 0x 4d0 */
|
||||
205,128,139, 77,224,255, 69,204, 15,183, 65, 44,131, 69,212, 32, /* 0x 4e0 */
|
||||
57, 69,204, 15,140, 38,254,255,255,131,125,220, 0,117, 14,139, /* 0x 4f0 */
|
||||
93,228,106, 6, 88,205,128,133,192,116, 20,235,134,139, 69,224, /* 0x 500 */
|
||||
102,131,120, 16, 3,116, 8,139, 93,240,106, 45, 88,205,128,131, /* 0x 510 */
|
||||
125, 16, 0,116, 8,139, 77,208,139, 85, 16,137, 10,139, 93,224, /* 0x 520 */
|
||||
139, 91, 24, 1, 93,208,139, 69,208,141,101,244, 91, 94, 95,201, /* 0x 530 */
|
||||
195, 85,137,229, 87, 86, 83,131,236, 24,139,125, 28,106, 0,139, /* 0x 540 */
|
||||
69, 16,141, 87, 52,139,117, 8, 80,139, 93, 32,137, 69,236,137, /* 0x 550 */
|
||||
85,232,141, 69, 32,141, 85, 24,232, 0,252,255,255,139, 69, 12, /* 0x 560 */
|
||||
15,183, 79, 44,186, 5, 0, 0, 0,137, 69, 32,137,240, 41, 93, /* 0x 570 */
|
||||
36,232,198,252,255,255, 15,183, 79, 42,186, 4, 0, 0, 0,137, /* 0x 580 */
|
||||
240,232,182,252,255,255,139, 93,232,139, 77, 40,186, 3, 0, 0, /* 0x 590 */
|
||||
0, 3, 75, 8,137,240,131,193, 52,232,158,252,255,255,141, 69, /* 0x 5a0 */
|
||||
240,137,250, 80,141, 69, 32, 86, 80,139, 69,236,232,177,252,255, /* 0x 5b0 */
|
||||
255,186, 9, 0, 0, 0,137,193,137,195,137,240,232,123,252,255, /* 0x 5c0 */
|
||||
255,102,139, 79, 44,131,196, 20, 49,210,102,133,201,116, 94,139, /* 0x 5d0 */
|
||||
69,232,131, 56, 3,117, 74,139, 93,240, 49,201, 3, 88, 8,137, /* 0x 5e0 */
|
||||
202,106, 5, 88,205,128,133,192,137,198,120, 21,186, 0, 2, 0, /* 0x 5f0 */
|
||||
0,137,195,137,249,106, 3, 88,205,128, 61, 0, 2, 0, 0,116, /* 0x 600 */
|
||||
10,106,127, 91,106, 1, 88,205,128,235,254,106, 0,137,250,106, /* 0x 610 */
|
||||
0,137,240,106, 0,232, 72,252,255,255,131,196, 12,137,195,235, /* 0x 620 */
|
||||
12, 66, 15,183,193,131, 69,232, 32, 57,194,124,162,141,101,244, /* 0x 630 */
|
||||
137,216, 91, 94, 95,201,195 /* 0x 640 */
|
||||
91,195, 85,137,229, 87, 86, 83,131,236, 68,137, 69,228,139, 69, /* 0x 270 */
|
||||
8,137, 85,224,139, 93,224,139, 85, 12,137, 69,220,139, 69,224, /* 0x 280 */
|
||||
139, 77, 20,137, 85,216, 3, 91, 28,139, 85,224,137, 77,212,102, /* 0x 290 */
|
||||
131,120, 16, 2, 15,183, 74, 44,137, 93,208, 15,148,192,131,207, /* 0x 2a0 */
|
||||
255, 15,182,192,137,202,193,224, 4, 49,246,131,192, 34, 74,120, /* 0x 2b0 */
|
||||
28,131, 59, 1,117, 18,139, 83, 8, 57,250,115, 2,137,215, 3, /* 0x 2c0 */
|
||||
83, 20, 57,214,115, 2,137,214,131,195, 32,226,228,137,251,106, /* 0x 2d0 */
|
||||
0,129,227, 0,240,255,255,106,255, 41,222, 80,129,198,255, 15, /* 0x 2e0 */
|
||||
0, 0,106, 0,129,230, 0,240,255,255, 86, 83,232, 50,254,255, /* 0x 2f0 */
|
||||
255,139, 77,224,141, 52, 48,131,196, 24, 41,216,102,131,121, 44, /* 0x 300 */
|
||||
0,137,117,240,137, 69,204,199, 69,200, 0, 0, 0, 0, 15,132, /* 0x 310 */
|
||||
215, 1, 0, 0,139, 93,208,139, 3,131,248, 6,117, 24,139, 77, /* 0x 320 */
|
||||
204,186, 3, 0, 0, 0, 3, 75, 8,139, 69,216,232, 11,255,255, /* 0x 330 */
|
||||
255,233,158, 1, 0, 0, 72, 15,133,151, 1, 0, 0,139, 69,208, /* 0x 340 */
|
||||
199, 69,196, 64, 98, 81,115,139, 85,208,139, 72, 24,139, 90, 20, /* 0x 350 */
|
||||
131,225, 7,193,225, 2,211,109,196,139, 72, 16,139, 69,204, 3, /* 0x 360 */
|
||||
66, 8,137, 77,232,131,101,196, 7,137,194, 1,195,129,226,255, /* 0x 370 */
|
||||
15, 0, 0,137,199,141, 52, 17,139, 77,208,137, 69,236, 41,215, /* 0x 380 */
|
||||
139, 65, 4,137, 93,192, 41,208,131,125,220, 0, 80,139, 69,228, /* 0x 390 */
|
||||
116, 3,131,200,255,131,125,220, 1, 80, 25,192,131,224,224,131, /* 0x 3a0 */
|
||||
192, 50,131,125,220, 0, 80,139, 69,196,116, 3,131,200, 2,131, /* 0x 3b0 */
|
||||
125,220, 0, 80,137,240,116, 3,141, 70, 3, 80, 87,232, 97,253, /* 0x 3c0 */
|
||||
255,255,131,196, 24, 57,199, 15,133,184, 0, 0, 0,131,125,220, /* 0x 3d0 */
|
||||
0,116, 28,246, 69,196, 4,139, 69,212,117, 2, 49,192, 80,139, /* 0x 3e0 */
|
||||
69,220,255,117,228,141, 85,232,232,112,253,255,255, 88, 90,137, /* 0x 3f0 */
|
||||
243,247,219,129,227,255, 15, 0, 0,246, 69,196, 2,137, 93,188, /* 0x 400 */
|
||||
116, 15,133,219,141, 4, 55,116, 8,137,217,198, 0, 0, 64,226, /* 0x 410 */
|
||||
250,131,125,220, 0,116,120,139, 69,208,131, 56, 1,117, 86,246, /* 0x 420 */
|
||||
64, 24, 1,116, 80,139, 80, 20,139, 88, 8,141, 12, 26, 3, 77, /* 0x 430 */
|
||||
204, 59, 80, 16,117, 14,137,200,247,216, 37,255, 15, 0, 0,131, /* 0x 440 */
|
||||
248, 3,119, 17,139, 85,208,107, 69,204, 52,131,122, 4, 0,141, /* 0x 450 */
|
||||
76, 3, 12,117, 15,139, 1, 61,205,128, 97,195,116, 6,199, 1, /* 0x 460 */
|
||||
205,128, 97,195,133,201,116, 13,139, 69,216, 49,210,131,224,254, /* 0x 470 */
|
||||
232,199,253,255,255,137,251,137,241,139, 85,196,106,125, 88,205, /* 0x 480 */
|
||||
128,133,192,116, 10,106,127, 91,106, 1, 88,205,128,235,254,139, /* 0x 490 */
|
||||
85,188,141, 4, 22,141, 28, 7, 59, 93,192,115, 30,106, 0,106, /* 0x 4a0 */
|
||||
255,106, 50,255,117,196, 41, 93,192,255,117,192, 83,232,113,252, /* 0x 4b0 */
|
||||
255,255,131,196, 24, 57,195,116, 27,235,202,131,125,220, 0,116, /* 0x 4c0 */
|
||||
19,141, 78, 3,129,225,255, 15, 0, 0,131,249, 3,119, 5,106, /* 0x 4d0 */
|
||||
91, 88,205,128,139, 77,224,255, 69,200, 15,183, 65, 44,131, 69, /* 0x 4e0 */
|
||||
208, 32, 57, 69,200, 15,140, 41,254,255,255,131,125,220, 0,117, /* 0x 4f0 */
|
||||
14,139, 93,228,106, 6, 88,205,128,133,192,116, 20,235,134,139, /* 0x 500 */
|
||||
69,224,102,131,120, 16, 3,116, 8,139, 93,240,106, 45, 88,205, /* 0x 510 */
|
||||
128,131,125, 16, 0,116, 8,139, 77,204,139, 85, 16,137, 10,139, /* 0x 520 */
|
||||
93,224,139, 91, 24, 1, 93,204,139, 69,204,141,101,244, 91, 94, /* 0x 530 */
|
||||
95,201,195, 85,137,229, 87, 86, 83,131,236, 28,139,125, 28,106, /* 0x 540 */
|
||||
0,139, 69, 16,141, 87, 52,139,117, 8,137, 69,236,131,192, 2, /* 0x 550 */
|
||||
255,117,236,137, 85,228,139, 93, 32,137, 69,232,141, 85, 24,141, /* 0x 560 */
|
||||
69, 32,232,246,251,255,255,139, 69, 12, 15,183, 79, 44,186, 5, /* 0x 570 */
|
||||
0, 0, 0,137, 69, 32,137,240, 41, 93, 36,232,188,252,255,255, /* 0x 580 */
|
||||
15,183, 79, 42,186, 4, 0, 0, 0,137,240,232,172,252,255,255, /* 0x 590 */
|
||||
139, 93,228,139, 77, 40,186, 3, 0, 0, 0, 3, 75, 8,137,240, /* 0x 5a0 */
|
||||
131,193, 52,232,148,252,255,255,141, 69,240,255,117,232,137,250, /* 0x 5b0 */
|
||||
80,141, 69, 32, 86, 80,139, 69,236,232,164,252,255,255,186, 9, /* 0x 5c0 */
|
||||
0, 0, 0,137,193,137,195,137,240,232,110,252,255,255,102,139, /* 0x 5d0 */
|
||||
79, 44,131,196, 24, 49,210,102,133,201,116, 96,139, 69,228,131, /* 0x 5e0 */
|
||||
56, 3,117, 76,139, 93,240, 49,201, 3, 88, 8,137,202,106, 5, /* 0x 5f0 */
|
||||
88,205,128,133,192,137,198,120, 21,186, 0, 2, 0, 0,137,195, /* 0x 600 */
|
||||
137,249,106, 3, 88,205,128, 61, 0, 2, 0, 0,116, 10,106,127, /* 0x 610 */
|
||||
91,106, 1, 88,205,128,235,254,106, 0,137,250,106, 0,137,240, /* 0x 620 */
|
||||
106, 0,106, 0,232, 57,252,255,255,131,196, 16,137,195,235, 12, /* 0x 630 */
|
||||
66, 15,183,193,131, 69,228, 32, 57,194,124,160,141,101,244,137, /* 0x 640 */
|
||||
216, 91, 94, 95,201,195 /* 0x 650 */
|
||||
};
|
||||
|
||||
@ -55,9 +55,9 @@ struct Extent {
|
||||
|
||||
|
||||
static void
|
||||
#if (ACC_CC_GNUC >= 0x030300)
|
||||
#if (ACC_CC_GNUC >= 0x030300) && defined(__i386__) /*{*/
|
||||
__attribute__((__noinline__, __used__, regparm(3), stdcall))
|
||||
#endif
|
||||
#endif /*}*/
|
||||
xread(struct Extent *x, char *buf, size_t count)
|
||||
{
|
||||
char *p=x->buf, *q=buf;
|
||||
@ -96,7 +96,7 @@ do_brk(void *addr)
|
||||
return brk(addr);
|
||||
}
|
||||
|
||||
extern char *mmap(void *addr, size_t len,
|
||||
extern void *mmap(void *addr, size_t len,
|
||||
int prot, int flags, int fd, off_t offset);
|
||||
|
||||
/*************************************************************************
|
||||
@ -172,10 +172,11 @@ ERR_LAB
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__i386__) /*{*/
|
||||
// Create (or find) an escape hatch to use when munmapping ourselves the stub.
|
||||
// Called by do_xmap to create it; remembered in AT_NULL.d_val
|
||||
static void *
|
||||
make_hatch(Elf32_Phdr const *const phdr, unsigned const reloc)
|
||||
make_hatch_x86(Elf32_Phdr const *const phdr, unsigned const reloc)
|
||||
{
|
||||
unsigned *hatch = 0;
|
||||
if (phdr->p_type==PT_LOAD && phdr->p_flags & PF_X) {
|
||||
@ -204,9 +205,41 @@ make_hatch(Elf32_Phdr const *const phdr, unsigned const reloc)
|
||||
}
|
||||
return hatch;
|
||||
}
|
||||
#elif defined(__arm__) /*}{*/
|
||||
static void *
|
||||
make_hatch_arm(Elf32_Phdr const *const phdr, unsigned const reloc)
|
||||
{
|
||||
unsigned *hatch = 0;
|
||||
|
||||
if (phdr->p_type==PT_LOAD && phdr->p_flags & PF_X) {
|
||||
// The format of the 'if' is
|
||||
// if ( ( (hatch = loc1), test_loc1 )
|
||||
// || ( (hatch = loc2), test_loc2 ) ) {
|
||||
// action
|
||||
// }
|
||||
// which uses the comma to save bytes when test_locj involves locj
|
||||
// and the action is the same when either test succeeds.
|
||||
|
||||
// Try page fragmentation just beyond .text .
|
||||
if ( ( (hatch = (void *)(phdr->p_memsz + phdr->p_vaddr + reloc)),
|
||||
( phdr->p_memsz==phdr->p_filesz // don't pollute potential .bss
|
||||
&& 8<=(~PAGE_MASK & -(int)hatch) ) ) // space left on page
|
||||
// Try Elf32_Ehdr.e_ident[8..15] . warning: 'const' cast away
|
||||
|| ( (hatch = (void *)(&((Elf32_Ehdr *)phdr->p_vaddr + reloc)->e_ident[8])),
|
||||
(phdr->p_offset==0) ) )
|
||||
{
|
||||
hatch[0]= 0xef90005b; // syscall __NR_unmap
|
||||
hatch[1]= 0xe1a0f00e; // mov pc,lr
|
||||
}
|
||||
}
|
||||
return hatch;
|
||||
}
|
||||
#endif /*}*/
|
||||
|
||||
static void
|
||||
#if defined(__i386__) /*{*/
|
||||
__attribute__((regparm(2), stdcall))
|
||||
#endif /*}*/
|
||||
upx_bzero(char *p, size_t len)
|
||||
{
|
||||
if (len) do {
|
||||
@ -217,7 +250,9 @@ upx_bzero(char *p, size_t len)
|
||||
|
||||
|
||||
static void
|
||||
#if defined(__i386__) /*{*/
|
||||
__attribute__((regparm(3), stdcall))
|
||||
#endif /*}*/
|
||||
auxv_up(Elf32_auxv_t *av, unsigned const type, unsigned const value)
|
||||
{
|
||||
if (av && 0==(1&(int)av)) /* PT_INTERP usually inhibits, except for hatch */
|
||||
@ -247,7 +282,9 @@ auxv_up(Elf32_auxv_t *av, unsigned const type, unsigned const value)
|
||||
// and mmap that much, to be sure that a kernel using exec-shield-randomize
|
||||
// won't place the first piece in a way that leaves no room for the rest.
|
||||
static unsigned long // returns relocation constant
|
||||
#if defined(__i386__) /*{*/
|
||||
__attribute__((regparm(3), stdcall))
|
||||
#endif /*}*/
|
||||
xfind_pages(unsigned mflags, Elf32_Phdr const *phdr, int phnum,
|
||||
char **const p_brk
|
||||
)
|
||||
@ -276,10 +313,10 @@ xfind_pages(unsigned mflags, Elf32_Phdr const *phdr, int phnum,
|
||||
|
||||
static Elf32_Addr // entry address
|
||||
do_xmap(int const fdi, Elf32_Ehdr const *const ehdr, struct Extent *const xi,
|
||||
Elf32_auxv_t *const av, unsigned *p_reloc)
|
||||
Elf32_auxv_t *const av, unsigned *p_reloc, f_unfilter *const f_unf)
|
||||
{
|
||||
Elf32_Phdr const *phdr = (Elf32_Phdr const *) (ehdr->e_phoff +
|
||||
(char const *)ehdr);
|
||||
(void const *)ehdr);
|
||||
char *v_brk;
|
||||
unsigned const reloc = xfind_pages(
|
||||
((ET_EXEC==ehdr->e_type) ? MAP_FIXED : 0), phdr, ehdr->e_phnum, &v_brk);
|
||||
@ -298,15 +335,19 @@ do_xmap(int const fdi, Elf32_Ehdr const *const ehdr, struct Extent *const xi,
|
||||
mlen += frag;
|
||||
addr -= frag;
|
||||
|
||||
// Decompressor can overrun the destination by 3 bytes.
|
||||
if (addr != mmap(addr, mlen + (xi ? 3 : 0), prot | (xi ? PROT_WRITE : 0),
|
||||
if (addr != mmap(addr, mlen
|
||||
#if defined(__i386__) /*{*/
|
||||
// Decompressor can overrun the destination by 3 bytes.
|
||||
+ (xi ? 3 : 0)
|
||||
#endif /*}*/
|
||||
, prot | (xi ? PROT_WRITE : 0),
|
||||
MAP_FIXED | MAP_PRIVATE | (xi ? MAP_ANONYMOUS : 0),
|
||||
(xi ? -1 : fdi), phdr->p_offset - frag) ) {
|
||||
err_exit(8);
|
||||
}
|
||||
if (xi) {
|
||||
unpackExtent(xi, &xo, (f_expand *)fdi,
|
||||
((PROT_EXEC & prot) ? (f_unfilter *)(2+ fdi) : 0));
|
||||
((PROT_EXEC & prot) ? f_unf : 0) );
|
||||
}
|
||||
// Linux does not fixup the low end, so neither do we.
|
||||
//if (PROT_WRITE & prot) {
|
||||
@ -317,11 +358,18 @@ do_xmap(int const fdi, Elf32_Ehdr const *const ehdr, struct Extent *const xi,
|
||||
bzero(mlen+addr, frag); // fragment at hi end
|
||||
}
|
||||
if (xi) {
|
||||
void *const hatch = make_hatch(phdr, reloc);
|
||||
#if defined(__i386__) /*{*/
|
||||
void *const hatch = make_hatch_x86(phdr, reloc);
|
||||
if (0!=hatch) {
|
||||
/* always update AT_NULL, especially for compressed PT_INTERP */
|
||||
auxv_up((Elf32_auxv_t *)(~1 & (int)av), AT_NULL, (unsigned)hatch);
|
||||
}
|
||||
#elif defined(__arm__) /*}{*/
|
||||
void *const hatch = make_hatch_arm(phdr, reloc);
|
||||
if (0!=hatch) {
|
||||
auxv_up((Elf32_auxv_t *)(void *)av, AT_NULL, (unsigned)hatch);
|
||||
}
|
||||
#endif /*}*/
|
||||
if (0!=mprotect(addr, mlen, prot)) {
|
||||
err_exit(10);
|
||||
ERR_LAB
|
||||
@ -334,12 +382,14 @@ ERR_LAB
|
||||
err_exit(9);
|
||||
}
|
||||
}
|
||||
#if defined(__i386__) /*{*/
|
||||
else if (xi) { // cleanup if decompressor overrun crosses page boundary
|
||||
mlen = ~PAGE_MASK & (3+ mlen);
|
||||
if (mlen<=3) { // page fragment was overrun buffer only
|
||||
munmap(addr, mlen);
|
||||
}
|
||||
}
|
||||
#endif /*}*/
|
||||
}
|
||||
if (!xi) { // 2nd call (PT_INTERP); close()+check is smaller here
|
||||
if (0!=close(fdi)) {
|
||||
@ -369,7 +419,7 @@ void *upx_main(
|
||||
Elf32_auxv_t *const av,
|
||||
unsigned const sz_compressed,
|
||||
f_expand *const f_decompress,
|
||||
int junk, // %esp from 'pusha'
|
||||
f_unfilter */*const*/ f_unfilter,
|
||||
struct Extent xo,
|
||||
struct Extent xi,
|
||||
unsigned const volatile dynbase
|
||||
@ -379,13 +429,13 @@ void *upx_main(
|
||||
Elf32_auxv_t *const av,
|
||||
unsigned const sz_compressed,
|
||||
f_expand *const f_decompress,
|
||||
int junk, // %esp from 'pusha'
|
||||
f_unfilter */*const*/ f_unf,
|
||||
struct Extent xo, // {sz_unc, ehdr} for ELF headers
|
||||
struct Extent xi, // {sz_cpr, &b_info} for ELF headers
|
||||
unsigned const volatile dynbase // value+result: compiler must not change
|
||||
)
|
||||
{
|
||||
Elf32_Ehdr *const ehdr = (Elf32_Ehdr *)xo.buf; // temp char[MAX_ELF_HDR+OVERHEAD]
|
||||
Elf32_Ehdr *const ehdr = (Elf32_Ehdr *)(void *)xo.buf; // temp char[MAX_ELF_HDR+OVERHEAD]
|
||||
Elf32_Phdr const *phdr = (Elf32_Phdr const *)(1+ ehdr);
|
||||
Elf32_Addr reloc;
|
||||
Elf32_Addr entry;
|
||||
@ -393,7 +443,9 @@ void *upx_main(
|
||||
// sizeof(Ehdr+Phdrs), compressed; including b_info header
|
||||
size_t const sz_pckhdrs = xi.size;
|
||||
|
||||
(void)junk;
|
||||
#if defined(__i386__) /*{*/
|
||||
f_unf = (f_unfilter *)(2+ (long)f_decompress);
|
||||
#endif /*}*/
|
||||
|
||||
// Uncompress Ehdr and Phdrs.
|
||||
unpackExtent(&xi, &xo, f_decompress, 0);
|
||||
@ -411,7 +463,7 @@ void *upx_main(
|
||||
// AT_PHDR.a_un.a_val is set again by do_xmap if PT_PHDR is present.
|
||||
// This is necessary for ET_DYN if|when we override a prelink address.
|
||||
|
||||
entry = do_xmap((int)f_decompress, ehdr, &xi, av, &reloc);
|
||||
entry = do_xmap((int)f_decompress, ehdr, &xi, av, &reloc, f_unf);
|
||||
auxv_up(av, AT_ENTRY , entry); // might not be necessary?
|
||||
|
||||
{ // Map PT_INTERP program interpreter
|
||||
@ -425,7 +477,7 @@ void *upx_main(
|
||||
ERR_LAB
|
||||
err_exit(19);
|
||||
}
|
||||
entry = do_xmap(fdi, ehdr, 0, 0, 0);
|
||||
entry = do_xmap(fdi, ehdr, 0, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
131
src/stub/l_lx_elf32arm.S
Normal file
131
src/stub/l_lx_elf32arm.S
Normal file
@ -0,0 +1,131 @@
|
||||
/* l_lx_elf32arm.S -- Linux program entry point & decompressor (Elf binary)
|
||||
*
|
||||
* This file is part of the UPX executable compressor.
|
||||
*
|
||||
* Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
||||
* Copyright (C) 1996-2004 Laszlo Molnar
|
||||
* Copyright (C) 2000-2006 John F. Reiser
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* UPX and the UCL library are free software; you can redistribute them
|
||||
* and/or modify them under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING.
|
||||
* If not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
* <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||
*
|
||||
* John F. Reiser
|
||||
* <jreiser@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
sz_Elf32_Ehdr = 13*4
|
||||
sz_Elf32_Phdr = 8*4
|
||||
|
||||
sz_b_info= 12
|
||||
sz_unc= 0
|
||||
sz_cpr= 4
|
||||
b_method= 8
|
||||
|
||||
PROT_READ= 1
|
||||
PROT_WRITE= 2
|
||||
PROT_EXEC= 4
|
||||
|
||||
MAP_PRIVATE= 2
|
||||
MAP_FIXED= 0x10
|
||||
MAP_ANONYMOUS= 0x20
|
||||
|
||||
PAGE_SHIFT= 12
|
||||
PAGE_SIZE = -(~0<<PAGE_SHIFT)
|
||||
|
||||
// magic for the UPX linker
|
||||
#define SECT(n) .text 1; .asciz #n; .long n - _start; .text 0; n
|
||||
|
||||
#define BL(t) \
|
||||
.text 1; .long 0, bl##t - _start; .asciz #t; .long 0; \
|
||||
.text 0; .byte 0, 0, 0; bl##t: .byte 0xeb
|
||||
|
||||
/*__ARMOS000__*/
|
||||
_start: .globl _start
|
||||
/* Get some pages: enough
|
||||
to duplicate the entire compressed PT_LOAD, plus 1 page, located just after
|
||||
the brk() of the _un_compressed program. The address and length are pre-
|
||||
calculated by PackLinuxElf32arm::pack3(), and patched in at compress time.
|
||||
*/
|
||||
adr r12,start_params
|
||||
ldmia r12!,{r0,r1, r8,r10} @ ADRM,LENM, ADRC,CNTC
|
||||
stmdb sp!,{r0,r1,r2} @ ADRU,LENU,space for sz_unc
|
||||
mov r2,#PROT_READ | PROT_WRITE | PROT_EXEC
|
||||
mov r3,#MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS
|
||||
mvn r4,#0 @ -1; cater to *BSD for fd when MAP_ANON
|
||||
swi 0x009000c0 @ mmap64
|
||||
cmn r0,#4096
|
||||
bcs msg_SELinux
|
||||
mov r9,r0 @ destination for copy
|
||||
copy:
|
||||
ldmia r8!,{r0,r1,r2,r3,r4,r5,r6,r7}; subs r10,r10,#1
|
||||
stmia r9!,{r0,r1,r2,r3,r4,r5,r6,r7}; bne copy
|
||||
|
||||
mov lr,r9 @ dst for unfolded code
|
||||
sub r11,r9,r8 @ relocation amount
|
||||
ldmia r12!,{r9,r10} @ LENX,ADRX
|
||||
|
||||
ldrb r4,b_method+cpr0
|
||||
add r3,sp,#2*4 @ &sz_unc
|
||||
mov r2,lr @ dst
|
||||
ldr r1,sz_cpr +cpr0
|
||||
adr r0,sz_b_info +cpr0
|
||||
add r5,r12,r11 @ relocated f_decompress
|
||||
add pc,r12,r11 @ goto there; return to unfolded code
|
||||
|
||||
start_params:
|
||||
.ascii "ADRM" @ dst for map
|
||||
.ascii "LENM" @ len for map
|
||||
|
||||
.ascii "ADRC" @ src for copy
|
||||
.ascii "CNTC" @ cnt for copy: number of 32-byte blocks
|
||||
|
||||
.ascii "LENX" @ total size of compressed data
|
||||
.ascii "ADRX" @ &b_info of 1st compressed block (after moving)
|
||||
f_decompress:
|
||||
#include "armv4_n2e_d8.S"
|
||||
|
||||
.subsection 2
|
||||
msg_SELinux:
|
||||
mov r2,#L71 - L70 @ length
|
||||
adr r1,L70 @ message text
|
||||
mov r0,#2 @ fd stderr
|
||||
swi 0x00900004 @ write
|
||||
die:
|
||||
mov r0,#127
|
||||
swi 0x00900001 @ exit
|
||||
b die
|
||||
|
||||
/* Temporary until we get the buildLoader stuff working ... */
|
||||
.ascii "\n$Id: UPX (C) 1996-2006 the UPX Team. "
|
||||
.asciz "All Rights Reserved. http://upx.sf.net $\n"
|
||||
|
||||
L70:
|
||||
.asciz "PROT_EXEC|PROT_WRITE failed.\n"
|
||||
L71:
|
||||
.balign 4
|
||||
cpr0:
|
||||
/* { b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...} */
|
||||
|
||||
eof:
|
||||
/*__XTHEENDX__*/
|
||||
|
||||
/*
|
||||
vi:ts=8:et:nowrap
|
||||
*/
|
||||
|
||||
69
src/stub/l_lx_elf32arm.h
Normal file
69
src/stub/l_lx_elf32arm.h
Normal file
@ -0,0 +1,69 @@
|
||||
/* l_lx_elf32arm.h -- created from l_lx_elf32arm.bin, 536 (0x218) bytes
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2006 Laszlo Molnar
|
||||
Copyright (C) 2000-2006 John F. Reiser
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
and/or modify them under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
|
||||
#define LINUX_ELF32ARM_LOADER_SIZE 536
|
||||
#define LINUX_ELF32ARM_LOADER_ADLER32 0xbfbae653
|
||||
#define LINUX_ELF32ARM_LOADER_CRC32 0x2728e7c0
|
||||
|
||||
unsigned char linux_elf32arm_loader[536] = {
|
||||
88,192,143,226, 3, 5,188,232, 7, 0, 45,233, 7, 32,160,227, /* 0x 0 */
|
||||
50, 48,160,227, 0, 64,224,227,192, 0,144,239, 1, 10,112,227, /* 0x 10 */
|
||||
89, 0, 0, 42, 0,144,160,225,255, 0,184,232, 1,160, 90,226, /* 0x 20 */
|
||||
255, 0,169,232,251,255,255, 26, 9,224,160,225, 8,176, 73,224, /* 0x 30 */
|
||||
0, 6,188,232,212, 65,223,229, 8, 48,141,226, 14, 32,160,225, /* 0x 40 */
|
||||
196, 17,159,229,114, 15,143,226, 11, 80,140,224, 11,240,140,224, /* 0x 50 */
|
||||
65, 68, 82, 77, 76, 69, 78, 77, 65, 68, 82, 67, 67, 78, 84, 67, /* 0x 60 */
|
||||
76, 69, 78, 88, 65, 68, 82, 88,252, 64, 45,233, 0,112,129,224, /* 0x 70 */
|
||||
0, 80,224,227, 2, 65,160,227, 10, 0, 0,234, 24, 0,189,232, /* 0x 80 */
|
||||
7, 0, 64,224, 3, 32, 66,224, 0, 32,132,229,240,128,189,232, /* 0x 90 */
|
||||
1, 64,208,228, 4, 64,164,224, 4, 76,176,225, 14,240,160,225, /* 0x a0 */
|
||||
1, 48,208,228, 1, 48,194,228, 4, 64,148,224,247,255,255, 11, /* 0x b0 */
|
||||
250,255,255, 42, 1, 16,160,227, 3, 0, 0,234, 1, 16, 65,226, /* 0x c0 */
|
||||
4, 64,148,224,241,255,255, 11, 1, 16,161,224, 4, 64,148,224, /* 0x d0 */
|
||||
238,255,255, 11, 1, 16,161,224, 4, 64,148,224,235,255,255, 11, /* 0x e0 */
|
||||
245,255,255, 58, 3, 48, 81,226, 0, 16,160,227, 6, 0, 0, 58, /* 0x f0 */
|
||||
1, 80,208,228, 3, 84,133,225, 5, 80,240,225,222,255,255, 10, /* 0x 100 */
|
||||
197, 80,176,225, 15, 0, 0, 42, 2, 0, 0,234, 4, 64,148,224, /* 0x 110 */
|
||||
222,255,255, 11, 11, 0, 0, 42, 1, 16,160,227, 4, 64,148,224, /* 0x 120 */
|
||||
218,255,255, 11, 7, 0, 0, 42, 4, 64,148,224,215,255,255, 11, /* 0x 130 */
|
||||
1, 16,161,224, 4, 64,148,224,212,255,255, 11,249,255,255, 58, /* 0x 140 */
|
||||
4, 16,129,226, 3, 0, 0,234, 4, 64,148,224,207,255,255, 11, /* 0x 150 */
|
||||
1, 16,161,224, 2, 16,129,226, 5, 12,117,227, 0, 0, 0, 42, /* 0x 160 */
|
||||
1, 16,129,226, 0, 48,210,229, 5, 48,210,231, 1, 48,194,228, /* 0x 170 */
|
||||
1, 16, 81,226,251,255,255, 26,202,255,255,234, 30, 32,160,227, /* 0x 180 */
|
||||
96, 16,143,226, 2, 0,160,227, 4, 0,144,239,127, 0,160,227, /* 0x 190 */
|
||||
1, 0,144,239,252,255,255,234, 10, 36, 73,100, 58, 32, 85, 80, /* 0x 1a0 */
|
||||
88, 32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 50, 48, 48, 54, 32, /* 0x 1b0 */
|
||||
116,104,101, 32, 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108, /* 0x 1c0 */
|
||||
108, 32, 82,105,103,104,116,115, 32, 82,101,115,101,114,118,101, /* 0x 1d0 */
|
||||
100, 46, 32,104,116,116,112, 58, 47, 47,117,112,120, 46,115,102, /* 0x 1e0 */
|
||||
46,110,101,116, 32, 36, 10, 0, 80, 82, 79, 84, 95, 69, 88, 69, /* 0x 1f0 */
|
||||
67,124, 80, 82, 79, 84, 95, 87, 82, 73, 84, 69, 32,102, 97,105, /* 0x 200 */
|
||||
108,101,100, 46, 10, 0, 0, 0 /* 0x 210 */
|
||||
};
|
||||
49
src/stub/l_lx_elf32arm.lds
Normal file
49
src/stub/l_lx_elf32arm.lds
Normal file
@ -0,0 +1,49 @@
|
||||
/* l_lx_elf32arm.lds --
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 2000-2006 John F. Reiser
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
and/or modify them under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||
|
||||
John F. Reiser
|
||||
<jreiser@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||
OUTPUT_ARCH(arm)
|
||||
/*ENTRY(_start)*/
|
||||
PHDRS
|
||||
{
|
||||
text PT_LOAD FILEHDR PHDRS ;
|
||||
data PT_LOAD ; /* for setting brk(0) */
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
/* 0x00004000: below 0x00008000 usual, enough to avoid icache sync */
|
||||
. = 0x00008000 + SIZEOF_HEADERS + 12; /* 12==sizeof(l_info) */
|
||||
.text : {
|
||||
*(.text)
|
||||
*(.data)
|
||||
} : text
|
||||
.data : {
|
||||
} : data
|
||||
}
|
||||
@ -93,7 +93,7 @@ struct timespec {
|
||||
#if defined(__amd64__) || defined(__powerpc64__)
|
||||
#define PAGE_MASK (~0ul<<12) // discards the offset, keeps the page
|
||||
#define PAGE_SIZE ( 1ul<<12)
|
||||
#elif defined(__i386__) || defined(__powerpc__)
|
||||
#elif defined(__i386__) || defined(__powerpc__) || defined(__arm__)
|
||||
#define PAGE_MASK (~0ul<<12) // discards the offset, keeps the page
|
||||
#define PAGE_SIZE ( 1ul<<12)
|
||||
#endif
|
||||
@ -365,6 +365,7 @@ int munmap(void *, size_t);
|
||||
int mprotect(void const *, size_t, int);
|
||||
int open(char const *, unsigned, unsigned);
|
||||
ssize_t read(int, void *, size_t);
|
||||
void exit(int) __attribute__((noreturn));
|
||||
|
||||
#endif /*}*/
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user