--android-shlib for 32-bit ARM

Includes better handling of asl_delta in execution stub.

    	modified:   p_lx_elf.cpp
    	modified:   p_lx_elf.h
    	modified:   stub/src/arm.v4t-linux.shlib-init.S
    	modified:   stub/src/arm64-linux.shlib-init.S
This commit is contained in:
John Reiser
2018-01-27 22:00:16 -08:00
parent 5a28a51abc
commit be83788666
6 changed files with 1171 additions and 1055 deletions
File diff suppressed because it is too large Load Diff
+12 -6
View File
@@ -112,7 +112,7 @@ _=-1+_ // one less word on stack
#define lodslu bl get4u
section ELFMAINX
// .long offset(b_info) src for f_exp
// .long offset(b_info)|(asl_delta>>12) src for f_exp
//D_INFO:
// .long offset(.) // detect relocation
// .long offset(user DT_INIT)
@@ -135,13 +135,19 @@ o_uinit= 1 // lr
adr esi,here
sub esi,#(here - _start) + 5*NBPW // -NBPW + &D_INFO
here:
ldr tmp,[esi,#0*NBPW] // offset(b_info)
ldr tmp,[esi,#0*NBPW] // offset(b_info)|(asl_delta>>12)
mov edi,#1
add ecx,esi,#NBPW // &D_INFO
ldr eax,[esi,#1*NBPW]; sub ecx,eax; //str ecx,[SP(o_reloc)]
// reloc DT_INIT for step 12
ldr eax,[esi,#2*NBPW]; add eax,ecx; str eax,[SP(o_uinit)]
ldr eax,[esi,#1*NBPW]
and edi,tmp // asl_delta>>12
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
add eax,edi
str eax,[SP(o_uinit)] // reloc DT_INIT for step 12
ldr edi,[esi,#4*NBPW]; add edi,ecx // dst for f_exp
add esi,tmp,ecx // &b_info src for f_exp
add esi,tmp,ecx // &b_info src for f_exp
sub sp,#3*NBPW // 3 slots of space
_=1+_ // &escape_hatch (step 10)
+1 -1
View File
@@ -120,7 +120,7 @@ sp_frame = 24 * NBPW
.endm
section ELFMAINX
// .long offset(b_info) src of f_exp
// .long offset(b_info)|(asl_delta>>12) src of f_exp
// .long offset(.) // detect relocation
// .long offset(user DT_INIT)
// .long offset(escape_hatch)
+17 -17
View File
@@ -2,18 +2,18 @@ file format elf32-littlearm
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 00000094 00000000 00000000 00000034 2**2 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000000 00000000 00000000 000000c8 2**0 CONTENTS, READONLY
2 NRV_TAIL 00000000 00000000 00000000 000000c8 2**0 CONTENTS, READONLY
3 NRV2E 0000013c 00000000 00000000 000000c8 2**0 CONTENTS, RELOC, READONLY
4 NRV2D 00000128 00000000 00000000 00000204 2**0 CONTENTS, RELOC, READONLY
5 NRV2B 000000ec 00000000 00000000 0000032c 2**0 CONTENTS, RELOC, READONLY
6 LZMA_ELF00 000000b8 00000000 00000000 00000418 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000938 00000000 00000000 000004d0 2**0 CONTENTS, RELOC, READONLY
8 LZMA_DEC10 00000478 00000000 00000000 00000e08 2**0 CONTENTS, RELOC, READONLY
9 LZMA_DEC30 00000000 00000000 00000000 00001280 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003e 00000000 00000000 00001280 2**0 CONTENTS, READONLY
11 ELFMAINZ 00000184 00000000 00000000 000012c0 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 00000184 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
00000026 R_ARM_THM_CALL .real_start_ofELFMAINZ
00000040 R_ARM_THM_CALL .real_start_ofELFMAINX
00000084 R_ARM_THM_CALL .real_start_ofELFMAINZ
0000008a R_ARM_THM_CALL .real_start_ofELFMAINZ
00000090 R_ARM_THM_CALL .real_start_ofELFMAINZ
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
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE