1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Save 1 byte in dos/exe stub.

This commit is contained in:
Markus F.X.J. Oberhumer 2007-09-14 13:48:00 +02:00
parent 31bb6bedbd
commit 49455c99ad
5 changed files with 1900 additions and 1901 deletions

View File

@ -262,7 +262,6 @@ void Packer::defineDecompressorSymbols()
if (M_IS_LZMA(ph.method))
{
const lzma_compress_result_t *res = &ph.compress_result.result_lzma;
// FIXME - this is for i386 only
acc_uint32e_t properties = // lc, lp, pb, dummy
(res->lit_context_bits << 0) |
(res->lit_pos_bits << 8) |
@ -271,7 +270,7 @@ void Packer::defineDecompressorSymbols()
acc_swab32s(&properties);
linker->defineSymbol("lzma_properties", properties);
// -2 for properties
// len - 2 because of properties
linker->defineSymbol("lzma_c_len", ph.c_len - 2);
linker->defineSymbol("lzma_u_len", ph.u_len);
unsigned stack = getDecompressorWrkmemSize();
@ -279,10 +278,10 @@ void Packer::defineDecompressorSymbols()
if (ph.format == UPX_F_DOS_EXE)
{
linker->defineSymbol("lzma_properties_hi", properties / 65536);
// -2 for properties
linker->defineSymbol("lzma_c_len_hi", (ph.c_len - 2) / 65536);
linker->defineSymbol("lzma_u_len_hi", ph.u_len / 65536);
linker->defineSymbol("lzma_properties_hi", properties >> 16); // pb
// len - 2 because of properties
linker->defineSymbol("lzma_c_len_hi", (ph.c_len - 2) >> 16);
linker->defineSymbol("lzma_u_len_hi", ph.u_len >> 16);
linker->defineSymbol("lzma_u_len_segment", (ph.u_len & 0xf0000) >> 4);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -188,10 +188,10 @@ def main(argv):
if 1 and inst in ["movl",] and re.search(r"\b[de]s\b", args):
# work around a bug in objdump 2.17 (fixed in binutils 2.18)
inst = "mov"
m = re.search(r"^(.+?)\b0\s+(\w+):\s+(1|2|R_386_16|R_386_PC16)\s+(__\w+)$", args)
m = re.search(r"^(.+?)\b(0|0x0)\s+(\w+):\s+(1|2|R_386_16|R_386_PC16)\s+(__\w+)$", args)
if m:
# 1 or 2 byte reloc
args = m.group(1) + m.group(4)
args = m.group(1) + m.group(5)
olines.append([label, inst, args, None])
#
# pass 2

View File

@ -89,13 +89,13 @@ section LZMA_DEC00
push bx // &state __near [bp + 4]
// enter small memory model
push ds // save ds && dummy for call
push ds // save ds and dummy for call
push ss
pop ds
// fill properties
movw [bx], offset lzma_properties
movw [bx+2], offset lzma_properties_hi
// fill properties: lc lp pb
movw [bx], offset lzma_properties // lc lp
movb [bx+2], offset lzma_properties_hi // pb
ignore_reloc_overflow lzma_u_len
ignore_reloc_overflow lzma_c_len

View File

@ -71,29 +71,29 @@ Idx Name Size VMA LMA File off Algn Flags
66 NRV2EEX3 00000015 00000000 00000000 00000316 2**0 CONTENTS, RELOC, READONLY
67 N2E64K02 0000000b 00000000 00000000 0000032b 2**0 CONTENTS, READONLY
68 NRV2EEX9 00000004 00000000 00000000 00000336 2**0 CONTENTS, READONLY
69 LZMA_DEC00 00000033 00000000 00000000 0000033a 2**0 CONTENTS, RELOC, READONLY
70 ignore_reloc_overflow 00000008 00000000 00000000 0000036d 2**0 CONTENTS, RELOC, READONLY
71 LZMA_DEC10 00001207 00000000 00000000 00000375 2**0 CONTENTS, READONLY
72 LZMA_DEC20 0000129f 00000000 00000000 0000157c 2**0 CONTENTS, READONLY
73 LZMA_DEC30 00000001 00000000 00000000 0000281b 2**0 CONTENTS, READONLY
74 LZMA_DEC31 0000000c 00000000 00000000 0000281c 2**0 CONTENTS, RELOC, READONLY
75 LZMA_DEC32 00000005 00000000 00000000 00002828 2**0 CONTENTS, RELOC, READONLY
76 LZMA_DEC33 00000007 00000000 00000000 0000282d 2**0 CONTENTS, RELOC, READONLY
77 EXEMAIN5 00000001 00000000 00000000 00002834 2**0 CONTENTS, READONLY
78 EXEADJUS 00000007 00000000 00000000 00002835 2**0 CONTENTS, READONLY
79 EXENOADJ 00000002 00000000 00000000 0000283c 2**0 CONTENTS, READONLY
80 EXERELO1 0000001e 00000000 00000000 0000283e 2**0 CONTENTS, RELOC, READONLY
81 EXEREL9A 00000012 00000000 00000000 0000285c 2**0 CONTENTS, RELOC, READONLY
82 EXERELO2 00000004 00000000 00000000 0000286e 2**0 CONTENTS, READONLY
83 EXEREBIG 00000002 00000000 00000000 00002872 2**0 CONTENTS, RELOC, READONLY
84 EXERELO3 00000002 00000000 00000000 00002874 2**0 CONTENTS, RELOC, READONLY
85 EXEMAIN8 00000003 00000000 00000000 00002876 2**0 CONTENTS, READONLY
86 DEVICEEND 00000013 00000000 00000000 00002879 2**0 CONTENTS, READONLY
87 EXESTACK 00000006 00000000 00000000 0000288c 2**0 CONTENTS, RELOC, READONLY
88 EXESTASP 00000003 00000000 00000000 00002892 2**0 CONTENTS, RELOC, READONLY
89 EXEJUMPF 00000005 00000000 00000000 00002895 2**0 CONTENTS, RELOC, READONLY
90 EXERCSPO 00000004 00000000 00000000 0000289a 2**0 CONTENTS, RELOC, READONLY
91 EXERETIP 00000006 00000000 00000000 0000289e 2**0 CONTENTS, RELOC, READONLY
69 LZMA_DEC00 00000032 00000000 00000000 0000033a 2**0 CONTENTS, RELOC, READONLY
70 ignore_reloc_overflow 00000008 00000000 00000000 0000036c 2**0 CONTENTS, RELOC, READONLY
71 LZMA_DEC10 00001207 00000000 00000000 00000374 2**0 CONTENTS, READONLY
72 LZMA_DEC20 0000129f 00000000 00000000 0000157b 2**0 CONTENTS, READONLY
73 LZMA_DEC30 00000001 00000000 00000000 0000281a 2**0 CONTENTS, READONLY
74 LZMA_DEC31 0000000c 00000000 00000000 0000281b 2**0 CONTENTS, RELOC, READONLY
75 LZMA_DEC32 00000005 00000000 00000000 00002827 2**0 CONTENTS, RELOC, READONLY
76 LZMA_DEC33 00000007 00000000 00000000 0000282c 2**0 CONTENTS, RELOC, READONLY
77 EXEMAIN5 00000001 00000000 00000000 00002833 2**0 CONTENTS, READONLY
78 EXEADJUS 00000007 00000000 00000000 00002834 2**0 CONTENTS, READONLY
79 EXENOADJ 00000002 00000000 00000000 0000283b 2**0 CONTENTS, READONLY
80 EXERELO1 0000001e 00000000 00000000 0000283d 2**0 CONTENTS, RELOC, READONLY
81 EXEREL9A 00000012 00000000 00000000 0000285b 2**0 CONTENTS, RELOC, READONLY
82 EXERELO2 00000004 00000000 00000000 0000286d 2**0 CONTENTS, READONLY
83 EXEREBIG 00000002 00000000 00000000 00002871 2**0 CONTENTS, RELOC, READONLY
84 EXERELO3 00000002 00000000 00000000 00002873 2**0 CONTENTS, RELOC, READONLY
85 EXEMAIN8 00000003 00000000 00000000 00002875 2**0 CONTENTS, READONLY
86 DEVICEEND 00000013 00000000 00000000 00002878 2**0 CONTENTS, READONLY
87 EXESTACK 00000006 00000000 00000000 0000288b 2**0 CONTENTS, RELOC, READONLY
88 EXESTASP 00000003 00000000 00000000 00002891 2**0 CONTENTS, RELOC, READONLY
89 EXEJUMPF 00000005 00000000 00000000 00002894 2**0 CONTENTS, RELOC, READONLY
90 EXERCSPO 00000004 00000000 00000000 00002899 2**0 CONTENTS, RELOC, READONLY
91 EXERETIP 00000006 00000000 00000000 0000289d 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
00000000 l d DEVICEENTRY 00000000 DEVICEENTRY
00000000 l d COMPRESSED_LZMA_START 00000000 COMPRESSED_LZMA_START
@ -382,7 +382,7 @@ OFFSET TYPE VALUE
0000001a R_386_16 lzma_c_len_hi
0000001e R_386_16 lzma_c_len
0000002c R_386_16 lzma_properties
00000031 R_386_16 lzma_properties_hi
00000031 R_386_8 lzma_properties_hi
RELOCATION RECORDS FOR [ignore_reloc_overflow]:
OFFSET TYPE VALUE