mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Updated packers to use new stub names.
This commit is contained in:
parent
989d10a3e1
commit
2ced230965
|
@ -464,8 +464,8 @@ bool PackArmPe::canPack()
|
|||
|
||||
void PackArmPe::buildLoader(const Filter *ft)
|
||||
{
|
||||
const unsigned char *loader = use_thumb_stub ? nrv_loader_thumb : nrv_loader_arm;
|
||||
unsigned size = use_thumb_stub ? sizeof(nrv_loader_thumb) : sizeof(nrv_loader_arm);
|
||||
const unsigned char *loader = use_thumb_stub ? stub_arm_v4t_wince_pe : stub_arm_v4a_wince_pe;
|
||||
unsigned size = use_thumb_stub ? sizeof(stub_arm_v4t_wince_pe) : sizeof(stub_arm_v4a_wince_pe);
|
||||
|
||||
// prepare loader
|
||||
initLoader(loader, size);
|
||||
|
|
|
@ -138,7 +138,7 @@ void PackCom::patchLoader(OutputFile *fo,
|
|||
|
||||
void PackCom::buildLoader(const Filter *ft)
|
||||
{
|
||||
initLoader(nrv2b_loader,sizeof(nrv2b_loader));
|
||||
initLoader(stub_i086_dos16_com, sizeof(stub_i086_dos16_com));
|
||||
addLoader("COMMAIN1",
|
||||
ph.first_offset_found == 1 ? "COMSBBBP" : "",
|
||||
"COMPSHDI",
|
||||
|
|
|
@ -49,11 +49,11 @@ PackDjgpp2::PackDjgpp2(InputFile *f) :
|
|||
bele = &N_BELE_RTP::le_policy;
|
||||
COMPILE_TIME_ASSERT(sizeof(external_scnhdr_t) == 40);
|
||||
COMPILE_TIME_ASSERT(sizeof(coff_header_t) == 0xa8);
|
||||
COMPILE_TIME_ASSERT(sizeof(stubify_stub) == 2048);
|
||||
COMPILE_TIME_ASSERT(sizeof(stub_i386_dos32_djgpp2_stubify) == 2048);
|
||||
COMPILE_TIME_ASSERT_ALIGNOF(external_scnhdr_t, char)
|
||||
COMPILE_TIME_ASSERT_ALIGNOF(coff_header_t, char)
|
||||
COMPILE_TIME_ASSERT(STUBIFY_STUB_ADLER32 == 0xbf689ba8);
|
||||
COMPILE_TIME_ASSERT(STUBIFY_STUB_CRC32 == 0x2ae982b2);
|
||||
COMPILE_TIME_ASSERT(STUB_I386_DOS32_DJGPP2_STUBIFY_ADLER32 == 0xbf689ba8)
|
||||
COMPILE_TIME_ASSERT(STUB_I386_DOS32_DJGPP2_STUBIFY_CRC32 == 0x2ae982b2)
|
||||
//printf("0x%08x\n", upx_adler32(stubify_stub, sizeof(stubify_stub)));
|
||||
//assert(upx_adler32(stubify_stub, sizeof(stubify_stub)) == STUBIFY_STUB_ADLER32);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ Linker* PackDjgpp2::newLinker() const
|
|||
void PackDjgpp2::buildLoader(const Filter *ft)
|
||||
{
|
||||
// prepare loader
|
||||
initLoader(nrv_loader, sizeof(nrv_loader));
|
||||
initLoader(stub_i386_dos32_djgpp2, sizeof(stub_i386_dos32_djgpp2));
|
||||
addLoader("IDENTSTR,DJ2MAIN1",
|
||||
ft->id ? "DJCALLT1" : "",
|
||||
"DJ2MAIN2",
|
||||
|
@ -129,8 +129,8 @@ void PackDjgpp2::handleStub(OutputFile *fo)
|
|||
else
|
||||
{
|
||||
// "stubify" stub
|
||||
info("Adding stub: %ld bytes", (long)sizeof(stubify_stub));
|
||||
fo->write(stubify_stub, sizeof(stubify_stub));
|
||||
info("Adding stub: %ld bytes", (long)sizeof(stub_i386_dos32_djgpp2_stubify));
|
||||
fo->write(stub_i386_dos32_djgpp2_stubify, sizeof(stub_i386_dos32_djgpp2_stubify));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ void PackExe::buildLoader(const Filter *)
|
|||
int flag = fillExeHeader(&tmp_oh);
|
||||
|
||||
// prepare loader
|
||||
initLoader(nrv_loader,sizeof(nrv_loader));
|
||||
initLoader(stub_i086_dos16_exe, sizeof(stub_i086_dos16_exe));
|
||||
if (device_driver)
|
||||
addLoader("DEVICEENTRY", NULL);
|
||||
addLoader("EXEENTRY",
|
||||
|
|
|
@ -628,12 +628,12 @@ static const
|
|||
void
|
||||
PackLinuxElf32x86::buildLoader(const Filter *ft)
|
||||
{
|
||||
unsigned char tmp[sizeof(linux_i386elf_fold)];
|
||||
memcpy(tmp, linux_i386elf_fold, sizeof(linux_i386elf_fold));
|
||||
unsigned char tmp[sizeof(stub_i386_linux_elf_fold)];
|
||||
memcpy(tmp, stub_i386_linux_elf_fold, sizeof(stub_i386_linux_elf_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) {
|
||||
for (j = 0; j < sizeof(stub_i386_linux_elf_fold)-1; ++j) {
|
||||
if (0x60==tmp[ j]
|
||||
&& 0x47==tmp[1+j] ) {
|
||||
/* put INC EDI before PUSHA: inhibits auxv_up for PT_INTERP */
|
||||
|
@ -644,8 +644,8 @@ PackLinuxElf32x86::buildLoader(const Filter *ft)
|
|||
}
|
||||
}
|
||||
buildLinuxLoader(
|
||||
linux_i386elf_loader, sizeof(linux_i386elf_loader),
|
||||
tmp, sizeof(linux_i386elf_fold), ft );
|
||||
stub_i386_linux_elf_entry, sizeof(stub_i386_linux_elf_entry),
|
||||
tmp, sizeof(stub_i386_linux_elf_fold), ft );
|
||||
}
|
||||
|
||||
static const
|
||||
|
@ -656,12 +656,12 @@ static const
|
|||
void
|
||||
PackBSDElf32x86::buildLoader(const Filter *ft)
|
||||
{
|
||||
unsigned char tmp[sizeof(bsd_i386elf_fold)];
|
||||
memcpy(tmp, bsd_i386elf_fold, sizeof(bsd_i386elf_fold));
|
||||
unsigned char tmp[sizeof(stub_i386_bsd_elf_fold)];
|
||||
memcpy(tmp, stub_i386_bsd_elf_fold, sizeof(stub_i386_bsd_elf_fold));
|
||||
checkPatch(NULL, 0, 0, 0); // reset
|
||||
if (opt->o_unix.is_ptinterp) {
|
||||
unsigned j;
|
||||
for (j = 0; j < sizeof(bsd_i386elf_fold)-1; ++j) {
|
||||
for (j = 0; j < sizeof(stub_i386_bsd_elf_fold)-1; ++j) {
|
||||
if (0x60==tmp[ j]
|
||||
&& 0x47==tmp[1+j] ) {
|
||||
/* put INC EDI before PUSHA: inhibits auxv_up for PT_INTERP */
|
||||
|
@ -672,8 +672,8 @@ PackBSDElf32x86::buildLoader(const Filter *ft)
|
|||
}
|
||||
}
|
||||
buildLinuxLoader(
|
||||
bsd_i386elf_loader, sizeof(bsd_i386elf_loader),
|
||||
tmp, sizeof(bsd_i386elf_fold), ft );
|
||||
stub_i386_bsd_elf_entry, sizeof(stub_i386_bsd_elf_entry),
|
||||
tmp, sizeof(stub_i386_bsd_elf_fold), ft);
|
||||
}
|
||||
|
||||
#if 0 //{ re-use for OpenBSD, too
|
||||
|
@ -686,12 +686,12 @@ static const
|
|||
void
|
||||
PackOpenBSDElf32x86::buildLoader(const Filter *ft)
|
||||
{
|
||||
unsigned char tmp[sizeof(openbsd_i386elf_fold)];
|
||||
memcpy(tmp, openbsd_i386elf_fold, sizeof(openbsd_i386elf_fold));
|
||||
unsigned char tmp[sizeof(stub_i386_openbsd_elf_fold)];
|
||||
memcpy(tmp, stub_i386_openbsd_elf_fold, sizeof(stub_i386_openbsd_elf_fold));
|
||||
checkPatch(NULL, 0, 0, 0); // reset
|
||||
if (opt->o_unix.is_ptinterp) {
|
||||
unsigned j;
|
||||
for (j = 0; j < sizeof(openbsd_i386elf_fold)-1; ++j) {
|
||||
for (j = 0; j < sizeof(stub_i386_openbsd_elf_fold)-1; ++j) {
|
||||
if (0x60==tmp[ j]
|
||||
&& 0x47==tmp[1+j] ) {
|
||||
/* put INC EDI before PUSHA: inhibits auxv_up for PT_INTERP */
|
||||
|
@ -702,8 +702,8 @@ PackOpenBSDElf32x86::buildLoader(const Filter *ft)
|
|||
}
|
||||
}
|
||||
buildLinuxLoader(
|
||||
bsd_i386elf_loader, sizeof(bsd_i386elf_loader),
|
||||
tmp, sizeof(openbsd_i386elf_fold), ft );
|
||||
stub_i386_bsd_elf_entry, sizeof(stub_i386_bsd_elf_entry),
|
||||
tmp, sizeof(stub_i386_openbsd_elf_fold), ft);
|
||||
}
|
||||
|
||||
static const
|
||||
|
@ -722,16 +722,16 @@ void
|
|||
PackLinuxElf32armBe::buildLoader(Filter const *ft)
|
||||
{
|
||||
buildLinuxLoader(
|
||||
linux_elf32armeb_loader, sizeof(linux_elf32armeb_loader),
|
||||
linux_elf32armeb_fold, sizeof(linux_elf32armeb_fold), ft);
|
||||
stub_armeb_linux_elf_entry, sizeof(stub_armeb_linux_elf_entry),
|
||||
stub_armeb_linux_elf_fold, sizeof(stub_armeb_linux_elf_fold), ft);
|
||||
}
|
||||
|
||||
void
|
||||
PackLinuxElf32armLe::buildLoader(Filter const *ft)
|
||||
{
|
||||
buildLinuxLoader(
|
||||
linux_elf32arm_loader, sizeof(linux_elf32arm_loader),
|
||||
linux_elf32arm_fold, sizeof(linux_elf32arm_fold), ft);
|
||||
stub_arm_linux_elf_entry, sizeof(stub_arm_linux_elf_entry),
|
||||
stub_arm_linux_elf_fold, sizeof(stub_arm_linux_elf_fold), ft);
|
||||
}
|
||||
|
||||
static const
|
||||
|
@ -743,8 +743,8 @@ void
|
|||
PackLinuxElf32ppc::buildLoader(const Filter *ft)
|
||||
{
|
||||
buildLinuxLoader(
|
||||
linux_elfppc32_loader, sizeof(linux_elfppc32_loader),
|
||||
linux_elfppc32_fold, sizeof(linux_elfppc32_fold), ft );
|
||||
stub_powerpc_linux_elf_entry, sizeof(stub_powerpc_linux_elf_entry),
|
||||
stub_powerpc_linux_elf_fold, sizeof(stub_powerpc_linux_elf_fold), ft);
|
||||
}
|
||||
|
||||
static const
|
||||
|
@ -756,8 +756,8 @@ void
|
|||
PackLinuxElf64amd::buildLoader(const Filter *ft)
|
||||
{
|
||||
buildLinuxLoader(
|
||||
linux_elf64amd_loader, sizeof(linux_elf64amd_loader),
|
||||
linux_elf64amd_fold, sizeof(linux_elf64amd_fold), ft );
|
||||
stub_amd64_linux_elf_entry, sizeof(stub_amd64_linux_elf_entry),
|
||||
stub_amd64_linux_elf_fold, sizeof(stub_amd64_linux_elf_fold), ft);
|
||||
}
|
||||
|
||||
bool PackLinuxElf32::canPack()
|
||||
|
@ -1162,20 +1162,20 @@ void PackLinuxElf32::pack1(OutputFile */*fo*/, Filter &/*ft*/)
|
|||
void PackLinuxElf32x86::pack1(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
PackLinuxElf32::pack1(fo, ft);
|
||||
generateElfHdr(fo, linux_i386elf_fold, getbrk(phdri, get_native16(&ehdri.e_phnum)) );
|
||||
generateElfHdr(fo, stub_i386_linux_elf_fold, getbrk(phdri, get_native16(&ehdri.e_phnum)) );
|
||||
}
|
||||
|
||||
void PackBSDElf32x86::pack1(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
PackLinuxElf32::pack1(fo, ft);
|
||||
generateElfHdr(fo, bsd_i386elf_fold, getbrk(phdri, get_native16(&ehdri.e_phnum)) );
|
||||
generateElfHdr(fo, stub_i386_bsd_elf_fold, getbrk(phdri, get_native16(&ehdri.e_phnum)) );
|
||||
}
|
||||
|
||||
void PackLinuxElf32armLe::pack1(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
super::pack1(fo, ft);
|
||||
cprElfHdr3 h3;
|
||||
memcpy(&h3, linux_elf32arm_fold, sizeof(Elf32_Ehdr) + 2*sizeof(Elf32_Phdr));
|
||||
memcpy(&h3, stub_arm_linux_elf_fold, sizeof(Elf32_Ehdr) + 2*sizeof(Elf32_Phdr));
|
||||
generateElfHdr(fo, &h3, getbrk(phdri, get_native16(&ehdri.e_phnum)) );
|
||||
}
|
||||
|
||||
|
@ -1183,14 +1183,14 @@ void PackLinuxElf32armBe::pack1(OutputFile *fo, Filter &ft)
|
|||
{
|
||||
super::pack1(fo, ft);
|
||||
cprElfHdr3 h3;
|
||||
memcpy(&h3, linux_elf32armeb_fold, sizeof(Elf32_Ehdr) + 2*sizeof(Elf32_Phdr));
|
||||
memcpy(&h3, stub_armeb_linux_elf_fold, sizeof(Elf32_Ehdr) + 2*sizeof(Elf32_Phdr));
|
||||
generateElfHdr(fo, &h3, getbrk(phdri, get_native16(&ehdri.e_phnum)) );
|
||||
}
|
||||
|
||||
void PackLinuxElf32ppc::pack1(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
super::pack1(fo, ft);
|
||||
generateElfHdr(fo, linux_elfppc32_fold, getbrk(phdri, get_native16(&ehdri.e_phnum)) );
|
||||
generateElfHdr(fo, stub_powerpc_linux_elf_fold, getbrk(phdri, get_native16(&ehdri.e_phnum)) );
|
||||
}
|
||||
|
||||
void PackLinuxElf64::pack1(OutputFile */*fo*/, Filter &/*ft*/)
|
||||
|
@ -1212,7 +1212,7 @@ void PackLinuxElf64::pack1(OutputFile */*fo*/, Filter &/*ft*/)
|
|||
void PackLinuxElf64amd::pack1(OutputFile *fo, Filter &ft)
|
||||
{
|
||||
super::pack1(fo, ft);
|
||||
generateElfHdr(fo, linux_elf64amd_fold, getbrk(phdri, get_native16(&ehdri.e_phnum)) );
|
||||
generateElfHdr(fo, stub_amd64_linux_elf_fold, getbrk(phdri, get_native16(&ehdri.e_phnum)) );
|
||||
}
|
||||
|
||||
// Determine length of gap between PT_LOAD phdr[k] and closest PT_LOAD
|
||||
|
|
|
@ -183,7 +183,7 @@ PackLinuxI386::pack1(OutputFile *fo, Filter &)
|
|||
// create a pseudo-unique program id for our paranoid stub
|
||||
progid = getRandomId();
|
||||
|
||||
generateElfHdr(fo, linux_i386exec_fold, 0);
|
||||
generateElfHdr(fo, stub_i386_linux_elf_execve_fold, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -192,7 +192,7 @@ PackBSDI386::pack1(OutputFile *fo, Filter &)
|
|||
// create a pseudo-unique program id for our paranoid stub
|
||||
progid = getRandomId();
|
||||
|
||||
generateElfHdr(fo, bsd_i386exec_fold, 0);
|
||||
generateElfHdr(fo, stub_i386_bsd_elf_execve_fold, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -401,9 +401,9 @@ PackLinuxI386::buildLinuxLoader(
|
|||
void
|
||||
PackLinuxI386::buildLoader(Filter const *ft)
|
||||
{
|
||||
unsigned const sz_fold = sizeof(linux_i386exec_fold);
|
||||
unsigned const sz_fold = sizeof(stub_i386_linux_elf_execve_fold);
|
||||
MemBuffer buf(sz_fold);
|
||||
memcpy(buf, linux_i386exec_fold, sz_fold);
|
||||
memcpy(buf, stub_i386_linux_elf_execve_fold, sz_fold);
|
||||
|
||||
// patch loader
|
||||
// note: we only can use /proc/<pid>/fd when exetype > 0.
|
||||
|
@ -414,16 +414,16 @@ PackLinuxI386::buildLoader(Filter const *ft)
|
|||
patch_le32(buf,sz_fold,"UPX2",exetype > 0 ? 0 : 0x7fffffff);
|
||||
|
||||
buildLinuxLoader(
|
||||
linux_i386exec_loader, sizeof(linux_i386exec_loader),
|
||||
stub_i386_linux_elf_execve_entry, sizeof(stub_i386_linux_elf_execve_entry),
|
||||
buf, sz_fold, ft );
|
||||
}
|
||||
|
||||
void
|
||||
PackBSDI386::buildLoader(Filter const *ft)
|
||||
{
|
||||
unsigned const sz_fold = sizeof(bsd_i386exec_fold);
|
||||
unsigned const sz_fold = sizeof(stub_i386_bsd_elf_execve_fold);
|
||||
MemBuffer buf(sz_fold);
|
||||
memcpy(buf, bsd_i386exec_fold, sz_fold);
|
||||
memcpy(buf, stub_i386_bsd_elf_execve_fold, sz_fold);
|
||||
|
||||
// patch loader
|
||||
// note: we only can use /proc/<pid>/fd when exetype > 0.
|
||||
|
@ -434,7 +434,7 @@ PackBSDI386::buildLoader(Filter const *ft)
|
|||
patch_le32(buf,sz_fold,"UPX2",exetype > 0 ? 0 : 0x7fffffff);
|
||||
|
||||
buildLinuxLoader(
|
||||
bsd_i386exec_loader, sizeof(bsd_i386exec_loader),
|
||||
stub_i386_bsd_elf_execve_entry, sizeof(stub_i386_bsd_elf_execve_entry),
|
||||
buf, sz_fold, ft );
|
||||
}
|
||||
|
||||
|
|
|
@ -147,8 +147,8 @@ void PackLinuxElf32x86interp::pack3(OutputFile *fo, Filter &/*ft*/)
|
|||
}
|
||||
elfout.phdr[0].p_paddr = elfout.phdr[0].p_vaddr = base - sz;
|
||||
if (opt->o_unix.make_ptinterp) {
|
||||
initLoader(linux_i386pti_loader, sizeof(linux_i386pti_loader));
|
||||
linker->addSection("FOLDEXEC", linux_i386pti_fold, sizeof(linux_i386pti_fold), 0);
|
||||
initLoader(stub_i386_linux_elf_interp_entry, sizeof(stub_i386_linux_elf_interp_entry));
|
||||
linker->addSection("FOLDEXEC", stub_i386_linux_elf_interp_fold, sizeof(stub_i386_linux_elf_interp_fold), 0);
|
||||
|
||||
addLoader("LXPTI000", NULL);
|
||||
|
||||
|
|
|
@ -74,9 +74,9 @@ umax(unsigned a, unsigned b)
|
|||
void
|
||||
PackLinuxI386sh::buildLoader(Filter const *ft)
|
||||
{
|
||||
unsigned const sz_fold = sizeof(linux_i386sh_fold);
|
||||
unsigned const sz_fold = sizeof(stub_i386_linux_elf_shell_fold);
|
||||
MemBuffer buf(sz_fold);
|
||||
memcpy(buf, linux_i386sh_fold, sz_fold);
|
||||
memcpy(buf, stub_i386_linux_elf_shell_fold, sz_fold);
|
||||
|
||||
checkPatch(NULL, 0, 0, 0); // reset
|
||||
patch_le32(buf,sz_fold,"UPX3",l_shname);
|
||||
|
@ -100,7 +100,7 @@ PackLinuxI386sh::buildLoader(Filter const *ft)
|
|||
UNUSED(success);
|
||||
|
||||
buildLinuxLoader(
|
||||
linux_i386sh_loader, sizeof(linux_i386sh_loader),
|
||||
stub_i386_linux_elf_shell_entry, sizeof(stub_i386_linux_elf_shell_entry),
|
||||
buf, sz_fold, ft );
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ bool PackLinuxI386sh::canPack()
|
|||
void
|
||||
PackLinuxI386sh::pack1(OutputFile *fo, Filter &)
|
||||
{
|
||||
generateElfHdr(fo, linux_i386sh_fold, 0x08048000);
|
||||
generateElfHdr(fo, stub_i386_linux_elf_shell_fold, 0x08048000);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -139,8 +139,8 @@ void
|
|||
PackMachPPC32::buildLoader(const Filter *ft)
|
||||
{
|
||||
buildMachLoader(
|
||||
l_mac_ppc32_loader, sizeof(l_mac_ppc32_loader),
|
||||
fold_machppc32, sizeof(fold_machppc32), ft );
|
||||
stub_powerpc_darwin_macho_entry, sizeof(stub_powerpc_darwin_macho_entry),
|
||||
stub_powerpc_darwin_macho_fold, sizeof(stub_powerpc_darwin_macho_fold), ft );
|
||||
}
|
||||
void PackMachPPC32::patchLoader() { }
|
||||
void PackMachPPC32::updateLoader(OutputFile *) {}
|
||||
|
|
|
@ -321,7 +321,7 @@ void PackPs1::buildLoader(const Filter *)
|
|||
|
||||
if (ph.method == M_LZMA && !buildPart2)
|
||||
{
|
||||
initLoader(nrv_loader, sizeof(nrv_loader));
|
||||
initLoader(stub_mipsel_r3000_ps1, sizeof(stub_mipsel_r3000_ps1));
|
||||
addLoader("decompressor.start",
|
||||
isCon ? "LZMA_DEC20" : "LZMA_DEC10", "lzma.init", NULL);
|
||||
addLoader(sa_tmp > (0x10000 << 2) ? "memset.long" : "memset.short",
|
||||
|
@ -337,13 +337,13 @@ void PackPs1::buildLoader(const Filter *)
|
|||
NULL, M_NRV2B_8, 10, NULL, NULL );
|
||||
if (r != UPX_E_OK || sz_lcpr >= sz_lunc)
|
||||
throwInternalError("loader compression failed");
|
||||
initLoader(nrv_loader, sizeof(nrv_loader),
|
||||
initLoader(stub_mipsel_r3000_ps1, sizeof(stub_mipsel_r3000_ps1),
|
||||
(ph.method != M_LZMA || isCon) ? 0 : 1);
|
||||
linker->addSection("lzma.exec", cprLoader, sz_lcpr, 0);
|
||||
delete [] cprLoader;
|
||||
}
|
||||
else
|
||||
initLoader(nrv_loader, sizeof(nrv_loader));
|
||||
initLoader(stub_mipsel_r3000_ps1, sizeof(stub_mipsel_r3000_ps1));
|
||||
|
||||
pad_code = ALIGN_GAP((ph.c_len + (isCon ? sz_lcpr : 0)), 4);
|
||||
assert(pad_code < 4);
|
||||
|
|
|
@ -102,7 +102,7 @@ void PackSys::patchLoader(OutputFile *fo,
|
|||
|
||||
void PackSys::buildLoader(const Filter *ft)
|
||||
{
|
||||
initLoader(nrv2b_loader,sizeof(nrv2b_loader));
|
||||
initLoader(stub_i086_dos16_sys, sizeof(stub_i086_dos16_sys));
|
||||
addLoader("SYSMAIN1",
|
||||
opt->cpu == opt->CPU_8086 ? "SYSI0861" : "SYSI2861",
|
||||
"SYSMAIN2",
|
||||
|
|
|
@ -85,7 +85,7 @@ Linker* PackTmt::newLinker() const
|
|||
void PackTmt::buildLoader(const Filter *ft)
|
||||
{
|
||||
// prepare loader
|
||||
initLoader(nrv_loader,sizeof(nrv_loader));
|
||||
initLoader(stub_i386_dos32_tmt, sizeof(stub_i386_dos32_tmt));
|
||||
addLoader("IDENTSTR,TMTMAIN1",
|
||||
ft->id ? "TMTCALT1" : "",
|
||||
"TMTMAIN2,UPX1HEAD,TMTCUTPO",
|
||||
|
|
|
@ -115,7 +115,7 @@ void PackTos::buildLoader(const Filter *ft)
|
|||
{
|
||||
assert(ft->id == 0);
|
||||
|
||||
initLoader(nrv_loader, sizeof(nrv_loader));
|
||||
initLoader(stub_m68k_atari_tos, sizeof(stub_m68k_atari_tos));
|
||||
//linker->dumpSymbols();
|
||||
|
||||
//
|
||||
|
|
|
@ -228,7 +228,7 @@ Linker* PackVmlinuxI386::newLinker() const
|
|||
void PackVmlinuxI386::buildLoader(const Filter *ft)
|
||||
{
|
||||
// prepare loader
|
||||
initLoader(nrv_loader, sizeof(nrv_loader));
|
||||
initLoader(stub_i386_linux_kernel_vmlinux, sizeof(stub_i386_linux_kernel_vmlinux));
|
||||
addLoader("LINUX000",
|
||||
(0x40==(0xf0 & ft->id)) ? "LXCKLLT1" : (ft->id ? "LXCALLT1" : ""),
|
||||
"LXMOVEUP",
|
||||
|
@ -332,18 +332,18 @@ void PackVmlinuxI386::pack(OutputFile *fo)
|
|||
shdro[1].sh_type = Elf32_Shdr::SHT_PROGBITS;
|
||||
shdro[1].sh_flags = Elf32_Shdr::SHF_ALLOC | Elf32_Shdr::SHF_EXECINSTR;
|
||||
shdro[1].sh_offset = fo_off;
|
||||
shdro[1].sh_size = sizeof(head_stack) + ph.c_len + lsize;
|
||||
shdro[1].sh_size = sizeof(stub_i386_linux_kernel_vmlinux_head) + ph.c_len + lsize;
|
||||
shdro[1].sh_addralign = 1;
|
||||
|
||||
// ENTRY_POINT
|
||||
fo->write(&head_stack[0], sizeof(head_stack)-2*(1+ 4) +1);
|
||||
fo->write(&stub_i386_linux_kernel_vmlinux_head[0], sizeof(stub_i386_linux_kernel_vmlinux_head)-2*(1+ 4) +1);
|
||||
tmp_le32 = ehdri.e_entry; fo->write(&tmp_le32, 4);
|
||||
|
||||
// COMPRESSED_LENGTH
|
||||
fo->write(&head_stack[sizeof(head_stack)-(1+ 4)], 1);
|
||||
fo->write(&stub_i386_linux_kernel_vmlinux_head[sizeof(stub_i386_linux_kernel_vmlinux_head)-(1+ 4)], 1);
|
||||
tmp_le32 = ph.c_len; fo->write(&tmp_le32, 4);
|
||||
|
||||
fo_off += sizeof(head_stack);
|
||||
fo_off += sizeof(stub_i386_linux_kernel_vmlinux_head);
|
||||
|
||||
fo->write(obuf, ph.c_len); fo_off += ph.c_len;
|
||||
fo->write(loader, lsize); fo_off += lsize;
|
||||
|
@ -518,7 +518,7 @@ void PackVmlinuxI386::unpack(OutputFile *fo)
|
|||
ibuf.dealloc();
|
||||
|
||||
ph = ph_tmp;
|
||||
fi->seek(p_text->sh_offset + sizeof(head_stack) -5, SEEK_SET);
|
||||
fi->seek(p_text->sh_offset + sizeof(stub_i386_linux_kernel_vmlinux_head) -5, SEEK_SET);
|
||||
fi->readx(&buf[0], 5);
|
||||
if (0xE8!=buf[0] || get_le32(&buf[1]) != ph.c_len)
|
||||
{
|
||||
|
|
|
@ -273,7 +273,7 @@ Linker* PackVmlinuzI386::newLinker() const
|
|||
void PackVmlinuzI386::buildLoader(const Filter *ft)
|
||||
{
|
||||
// prepare loader
|
||||
initLoader(nrv_loader, sizeof(nrv_loader));
|
||||
initLoader(stub_i386_linux_kernel_vmlinuz, sizeof(stub_i386_linux_kernel_vmlinuz));
|
||||
addLoader("LINUZ000",
|
||||
ft->id ? "LZCALLT1" : "",
|
||||
"LZIMAGE0",
|
||||
|
@ -359,7 +359,7 @@ void PackVmlinuzI386::pack(OutputFile *fo)
|
|||
void PackBvmlinuzI386::buildLoader(const Filter *ft)
|
||||
{
|
||||
// prepare loader
|
||||
initLoader(nrv_loader, sizeof(nrv_loader));
|
||||
initLoader(stub_i386_linux_kernel_vmlinuz, sizeof(stub_i386_linux_kernel_vmlinuz));
|
||||
addLoader("LINUZ000",
|
||||
(0x40==(0xf0 & ft->id)) ? "LZCKLLT1" : (ft->id ? "LZCALLT1" : ""),
|
||||
"LBZIMAGE,IDENTSTR",
|
||||
|
|
|
@ -545,7 +545,7 @@ void PackW32Pe::buildLoader(const Filter *ft)
|
|||
tmp_tlsindex = 0;
|
||||
|
||||
// prepare loader
|
||||
initLoader(nrv_loader, sizeof(nrv_loader), 2);
|
||||
initLoader(stub_i386_win32_pe, sizeof(stub_i386_win32_pe), 2);
|
||||
addLoader(isdll ? "PEISDLL1" : "",
|
||||
"PEMAIN01",
|
||||
icondir_count > 1 ? (icondir_count == 2 ? "PEICONS1" : "PEICONS2") : "",
|
||||
|
|
|
@ -91,7 +91,7 @@ Linker* PackWcle::newLinker() const
|
|||
void PackWcle::buildLoader(const Filter *ft)
|
||||
{
|
||||
// prepare loader
|
||||
initLoader(nrv_loader,sizeof(nrv_loader));
|
||||
initLoader(stub_i386_dos32_watcom_le, sizeof(stub_i386_dos32_watcom_le));
|
||||
addLoader("IDENTSTR,WCLEMAIN,UPX1HEAD,WCLECUTP", NULL);
|
||||
|
||||
// fake alignment for the start of the decompressor
|
||||
|
|
Loading…
Reference in New Issue
Block a user