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

Fix ARM compress shared library.

This commit is contained in:
John Reiser 2013-05-10 16:20:52 -07:00
parent 0d3a2072b2
commit 9237e15adc
3 changed files with 1025 additions and 1012 deletions

View File

@ -111,30 +111,35 @@ _=-1+_ // one less word on stack
#define lodslu bl get4u
section ELFMAINX
//D_INFO:
// .long offset(.) // detect relocation
// .long offset(user DT_INIT)
// .long offset(escape_hatch)
// .long offset({p_info; b_info; compressed data})
// .long offset({l_info; p_info; b_info; compressed data})
#define DEBUG 0
.code 16 //; .balign 4
.real_start_ofELFMAINX:
.thumb_func
_start: .globl _start
nop //; bkpt_th // for debugging
nop
#if DEBUG //{
bkpt_th // for debugging
#endif //}
push {r0,r1,r2,r3,r4,r5,r6,r7,lr}
_=9
o_uinit= 1 // lr
adr tmp,here; mov esi,#4*4 + here - _start
adr esi,here
sub esi,esi,#4*4 + 2*(4+ DEBUG) // D_INFO
here:
sub esi,tmp,esi
mov ecx,esi
ldr eax,[esi,#0*4]; sub ecx,eax; //str ecx,[SP(o_reloc)]
// reloc DT_INIT for step 12
ldr tmp,[esi,#1*4]; add tmp,ecx; str tmp,[SP(o_uinit)]
ldr edi,[esi,#3*4]; add edi,ecx // &p_info; also destination for decompress
ldr edi,[esi,#3*4]; add edi,ecx // &l_info; also destination for decompress
// reloc &hatch (thumb mode) for step 10
ldr tmp,[esi,#2*4]; add tmp,ecx; add tmp,#1
mov esi,#sz_p_info
ldr tmp,[esi,#2*4]; add tmp,ecx
mov esi,#sz_l_info+sz_p_info
add esi,edi // &b_info
push_ tmp
@ -325,6 +330,13 @@ _=-5+_ // 22
blx eax // decompress
pop_ tmp // toss arg5
// Place the escape hatch
ldr edi,[SP(o_hatch)]
ldr tmp,hatch // the 2 instructions
str tmp,[edi]
add edi,#1 // thumb mode
str edi,[SP(o_hatch)]
//p_unflt // 21
pop {arg1,arg2,arg3,arg4, eax, r5} // r5= w_fragment [discard]
_=-6+_ // 15
@ -352,9 +364,10 @@ _=-3+_ // 12
.endif
pop {arg1,arg2, pc} // goto hatch
_=-3+_ // 9
//hatch:
// swi 0 // 0xdf00; munmap
// pop {r0,r1,r2,r3,r4,r5,r6,r7,pc} // 0xbdff; goto user DT_INIT
.balign 4
hatch:
swi 0 // 0xdf00; munmap
pop {r0,r1,r2,r3,r4,r5,r6,r7,pc} // 0xbdff; goto user DT_INIT
.thumb_func
movsl_subr:

File diff suppressed because it is too large Load Diff

View File

@ -2,18 +2,18 @@ file format elf32-littlearm
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 000000a0 00000000 00000000 00000034 2**2 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000000 00000000 00000000 000000d4 2**0 CONTENTS, READONLY
2 NRV_TAIL 00000000 00000000 00000000 000000d4 2**0 CONTENTS, READONLY
3 NRV2E 0000013c 00000000 00000000 000000d4 2**0 CONTENTS, RELOC, READONLY
4 NRV2D 00000128 00000000 00000000 00000210 2**0 CONTENTS, RELOC, READONLY
5 NRV2B 000000ec 00000000 00000000 00000338 2**0 CONTENTS, RELOC, READONLY
6 LZMA_ELF00 000000b8 00000000 00000000 00000424 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000938 00000000 00000000 000004dc 2**0 CONTENTS, RELOC, READONLY
8 LZMA_DEC10 00000478 00000000 00000000 00000e14 2**0 CONTENTS, RELOC, READONLY
9 LZMA_DEC30 00000000 00000000 00000000 0000128c 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 00000000 00000000 0000128c 2**0 CONTENTS, READONLY
11 ELFMAINZ 0000016c 00000000 00000000 000012cc 2**2 CONTENTS, RELOC, READONLY
0 ELFMAINX 0000009c 00000000 00000000 00000034 2**2 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000000 00000000 00000000 000000d0 2**0 CONTENTS, READONLY
2 NRV_TAIL 00000000 00000000 00000000 000000d0 2**0 CONTENTS, READONLY
3 NRV2E 0000013c 00000000 00000000 000000d0 2**0 CONTENTS, RELOC, READONLY
4 NRV2D 00000128 00000000 00000000 0000020c 2**0 CONTENTS, RELOC, READONLY
5 NRV2B 000000ec 00000000 00000000 00000334 2**0 CONTENTS, RELOC, READONLY
6 LZMA_ELF00 000000b8 00000000 00000000 00000420 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000938 00000000 00000000 000004d8 2**0 CONTENTS, RELOC, READONLY
8 LZMA_DEC10 00000478 00000000 00000000 00000e10 2**0 CONTENTS, RELOC, READONLY
9 LZMA_DEC30 00000000 00000000 00000000 00001288 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 00000000 00000000 00001288 2**0 CONTENTS, READONLY
11 ELFMAINZ 00000178 00000000 00000000 000012c8 2**2 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
00000000 l ELFMAINX 00000000 .real_start_ofELFMAINX
00000000 l d NRV2E 00000000 NRV2E
@ -38,11 +38,11 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE
00000030 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000048 R_ARM_THM_CALL .real_start_ofELFMAINX
00000090 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000096 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000009c R_ARM_THM_CALL .real_start_ofELFMAINZ
0000002c R_ARM_THM_CALL .real_start_ofELFMAINZ
00000044 R_ARM_THM_CALL .real_start_ofELFMAINX
0000008c R_ARM_THM_CALL .real_start_ofELFMAINZ
00000092 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000098 R_ARM_THM_CALL .real_start_ofELFMAINZ
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
@ -255,12 +255,12 @@ OFFSET TYPE VALUE
00000028 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000030 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000050 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000068 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000082 R_ARM_THM_CALL .real_start_ofELFMAINZ
000000b4 R_ARM_PC24 ELFMAINZ
000000d2 R_ARM_THM_CALL .real_start_ofELFMAINZ
000000f8 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000110 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000011a R_ARM_THM_CALL .real_start_ofELFMAINZ
00000124 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000012c R_ARM_THM_CALL .real_start_ofELFMAINZ
00000072 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000090 R_ARM_THM_CALL .real_start_ofELFMAINZ
000000c0 R_ARM_PC24 ELFMAINZ
000000de R_ARM_THM_CALL .real_start_ofELFMAINZ
00000104 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000011c R_ARM_THM_CALL .real_start_ofELFMAINZ
00000126 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000130 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000138 R_ARM_THM_CALL .real_start_ofELFMAINZ