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

arm32 stubs on linux: allow 0==user_DT_INIT as nop; somewhat expensive

modified:   stub/arm.v5a-linux.shlib-init.h
	modified:   stub/arm.v5t-linux.shlib-init.h
	modified:   stub/src/arm.v4a-linux.shlib-init.S
	modified:   stub/src/arm.v4t-linux.shlib-init.S
	modified:   stub/tmp/arm.v5a-linux.shlib-init.bin.dump
	modified:   stub/tmp/arm.v5t-linux.shlib-init.bin.dump
This commit is contained in:
John Reiser 2018-03-24 08:52:49 -07:00
parent 6722e8972e
commit c2b62359d5
6 changed files with 1751 additions and 1722 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -183,7 +183,9 @@ main:
mov ecx,esi
lodsl; sub ecx,ecx,eax; //str ecx,[fp,#o_reloc]
sub tmp,esi,tmp // &b_info
lodsl; add eax,ecx,eax; str eax,[fp,#o_uinit] // reloc DT_INIT for step 12
lodsl; cmp eax,#0; beq 0f
add eax,ecx,eax // reloc DT_INIT for step 12
0: str eax,[fp,#o_uinit]
lodsl; add eax,ecx,eax; push eax // reloc &hatch for step 10
o_hatch= -1*4
lodsl; add edi,ecx,eax // &l_info; also destination for decompress
@ -308,11 +310,18 @@ supervise:
error ARMEL_EABI4, ARM_OLDABI
#endif //}
ldmia sp!,{arg1,arg2,arg3, eax,ecx,r6,r7, fp,lr,pc}
hatch_empty:
ret
L620: // Implant escape hatch at end of .text
ldr eax,[fp,#o_hatch]
ldmia lr,{arg1,arg2}
ldmia lr,{arg1,arg2,arg3}
stmia eax,{arg1,arg2}
ldr tmp,[fp,#o_uinit]
cmp tmp,#0; bne 0f
str arg3,[eax]
str eax,[fp,#o_uinit]
0:
//p_unflt
ldmia sp!,{arg1,arg2,arg3,arg4, eax, r12} // r12= w_fragment [toss]

View File

@ -143,9 +143,10 @@ here:
sub tmp,edi // offset(b_info)
sub ecx,eax; //str ecx,[SP(o_reloc)]
lsl edi,#12 // asl_delta
ldr eax,[esi,#2*NBPW]; add eax,ecx
ldr eax,[esi,#2*NBPW]; cmp eax,#0; beq 0f
add eax,ecx // reloc DT_INIT for step 12
add eax,edi
str eax,[SP(o_uinit)] // reloc DT_INIT for step 12
0: str eax,[SP(o_uinit)]
ldr edi,[esi,#4*NBPW]; add edi,ecx // dst for f_exp
add esi,tmp,ecx // &b_info src for f_exp
@ -347,9 +348,17 @@ _=-5+_ // 22
bic edi,tmp // round_up(2, .p_memsz + .p_vaddr)
ldr tmp,hatch // the 2 instructions
str tmp,[edi]
ldr tmp,[SP(o_uinit)]
cmp tmp,#0; bne 0f
ldrh tmp,hatch_empty
strh tmp,[edi,#2*2]
add tmp,edi,#2*2
str tmp,[SP(o_uinit)]
0:
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
@ -381,6 +390,8 @@ _=-3+_ // 9
hatch:
swi 0 // 0xdf00; munmap
pop {r0,r1,r2,r3,r4,r5,r6,r7,pc} // 0xbdff; goto user DT_INIT
hatch_empty:
ret
.thumb_func
movsl_subr:

View File

@ -13,7 +13,7 @@ Idx Name Size VMA LMA File off Algn Flags
8 LZMA_DEC10 00000478 00000000 00000000 00000d84 2**0 CONTENTS, RELOC, READONLY
9 LZMA_DEC30 00000000 00000000 00000000 000011fc 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 00000000 00000000 000011fc 2**0 CONTENTS, READONLY
11 ELFMAINZ 00000308 00000000 00000000 0000123a 2**0 CONTENTS, RELOC, READONLY
11 ELFMAINZ 00000328 00000000 00000000 0000123a 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
00000000 l d NRV2E 00000000 NRV2E
00000000 l d NRV2D 00000000 NRV2D
@ -245,26 +245,28 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE
00000054 R_ARM_PC24 ELFMAINZ
0000007c R_ARM_PC24 ELFMAINZ
000000a8 R_ARM_PC24 ELFMAINZ
000000c4 R_ARM_PC24 ELFMAINZ
000000e8 R_ARM_PC24 ELFMAINZ
00000028 R_ARM_PC24 ELFMAINZ
0000005c R_ARM_PC24 ELFMAINZ
00000084 R_ARM_PC24 ELFMAINZ
000000b0 R_ARM_PC24 ELFMAINZ
000000cc R_ARM_PC24 ELFMAINZ
000000f0 R_ARM_PC24 ELFMAINZ
00000128 R_ARM_PC24 ELFMAINZ
000000f8 R_ARM_PC24 ELFMAINZ
00000130 R_ARM_PC24 ELFMAINZ
00000134 R_ARM_PC24 ELFMAINZ
0000015c R_ARM_PC24 ELFMAINZ
0000016c R_ARM_PC24 ELFMAINZ
0000017c R_ARM_PC24 ELFMAINZ
0000019c R_ARM_PC24 ELFMAINZ
000001f8 R_ARM_PC24 ELFMAINZ
00000200 R_ARM_PC24 ELFMAINZ
00000214 R_ARM_PC24 ELFMAINZ
00000228 R_ARM_PC24 ELFMAINZ
00000250 R_ARM_PC24 ELFMAINZ
00000264 R_ARM_PC24 ELFMAINZ
0000028c R_ARM_PC24 ELFMAINZ
0000029c R_ARM_PC24 ELFMAINZ
000002a8 R_ARM_PC24 ELFMAINZ
000002b4 R_ARM_PC24 ELFMAINZ
00000138 R_ARM_PC24 ELFMAINZ
0000013c R_ARM_PC24 ELFMAINZ
00000164 R_ARM_PC24 ELFMAINZ
00000174 R_ARM_PC24 ELFMAINZ
00000184 R_ARM_PC24 ELFMAINZ
000001a8 R_ARM_PC24 ELFMAINZ
000001bc R_ARM_PC24 ELFMAINZ
00000218 R_ARM_PC24 ELFMAINZ
00000220 R_ARM_PC24 ELFMAINZ
00000234 R_ARM_PC24 ELFMAINZ
00000248 R_ARM_PC24 ELFMAINZ
00000270 R_ARM_PC24 ELFMAINZ
00000284 R_ARM_PC24 ELFMAINZ
000002ac R_ARM_PC24 ELFMAINZ
000002bc R_ARM_PC24 ELFMAINZ
000002c8 R_ARM_PC24 ELFMAINZ
000002d4 R_ARM_PC24 ELFMAINZ

View File

@ -2,18 +2,18 @@ file format elf32-littlearm
Sections:
Idx Name Size VMA LMA File off Algn Flags
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 00000184 00000000 00000000 000012c8 2**2 CONTENTS, RELOC, READONLY
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 00000194 00000000 00000000 000012cc 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
0000008c R_ARM_THM_CALL .real_start_ofELFMAINZ
00000092 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000098 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000034 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000004c 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
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
0000007c R_ARM_THM_CALL .real_start_ofELFMAINZ
0000009c R_ARM_THM_CALL .real_start_ofELFMAINZ
000000cc R_ARM_PC24 ELFMAINZ
000000ea R_ARM_THM_CALL .real_start_ofELFMAINZ
00000110 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000128 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000132 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000013c R_ARM_THM_CALL .real_start_ofELFMAINZ
00000144 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000008a R_ARM_THM_CALL .real_start_ofELFMAINZ
000000aa R_ARM_THM_CALL .real_start_ofELFMAINZ
000000dc R_ARM_PC24 ELFMAINZ
000000fa R_ARM_THM_CALL .real_start_ofELFMAINZ
00000120 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000138 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000142 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000014c R_ARM_THM_CALL .real_start_ofELFMAINZ
00000154 R_ARM_THM_CALL .real_start_ofELFMAINZ