mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
new option "--ptinterp" for linux/elf386 compressing PT_INTERP file
p_lx_elf.cpp options.h main.cpp committer: jreiser <jreiser> 1032629299 +0000
This commit is contained in:
parent
8ad3d01d81
commit
124cdfda37
|
@ -692,6 +692,9 @@ static int do_option(int optc, const char *arg)
|
||||||
if (mfx_optarg && mfx_optarg[0])
|
if (mfx_optarg && mfx_optarg[0])
|
||||||
set_script_name(mfx_optarg,1);
|
set_script_name(mfx_optarg,1);
|
||||||
break;
|
break;
|
||||||
|
case 663:
|
||||||
|
opt->unix.ptinterp = true;
|
||||||
|
break;
|
||||||
case 670:
|
case 670:
|
||||||
opt->psx.no_align = true;
|
opt->psx.no_align = true;
|
||||||
break;
|
break;
|
||||||
|
@ -802,6 +805,7 @@ static const struct mfx_option longopts[] =
|
||||||
#if 0
|
#if 0
|
||||||
{"script", 0x31, 0, 662}, // --script=
|
{"script", 0x31, 0, 662}, // --script=
|
||||||
#endif
|
#endif
|
||||||
|
{"ptinterp", 0, 0, 663}, // linux/elf386 PT_INTERP program
|
||||||
// watcom/le
|
// watcom/le
|
||||||
{"le", 0, 0, 620}, // produce LE output
|
{"le", 0, 0, 620}, // produce LE output
|
||||||
// win32/pe
|
// win32/pe
|
||||||
|
|
|
@ -114,6 +114,7 @@ struct options_t {
|
||||||
struct {
|
struct {
|
||||||
unsigned blocksize;
|
unsigned blocksize;
|
||||||
bool force_execve; // force the linux/386 execve format
|
bool force_execve; // force the linux/386 execve format
|
||||||
|
bool ptinterp; // is PT_INTERP, so don't adjust auxv_t
|
||||||
enum { SCRIPT_MAX = 32 };
|
enum { SCRIPT_MAX = 32 };
|
||||||
const char *script_name;
|
const char *script_name;
|
||||||
} unix;
|
} unix;
|
||||||
|
|
|
@ -78,9 +78,23 @@ PackLinuxI386elf::getFilters() const
|
||||||
int
|
int
|
||||||
PackLinuxI386elf::buildLoader(const Filter *ft)
|
PackLinuxI386elf::buildLoader(const Filter *ft)
|
||||||
{
|
{
|
||||||
|
unsigned char tmp[sizeof(linux_i386elf_fold)];
|
||||||
|
memcpy(tmp, linux_i386elf_fold, sizeof(linux_i386elf_fold));
|
||||||
|
if (opt->unix.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(
|
return buildLinuxLoader(
|
||||||
linux_i386elf_loader, sizeof(linux_i386elf_loader),
|
linux_i386elf_loader, sizeof(linux_i386elf_loader),
|
||||||
linux_i386elf_fold, sizeof(linux_i386elf_fold), ft );
|
tmp, sizeof(linux_i386elf_fold), ft );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user