mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
thumb-eabi-linux.shlib, and use it (for smaller size) instead of ARM.
[Consider compress-time option to choose ARM vs thumb?]
This commit is contained in:
parent
4ca8357af4
commit
eeae73296e
|
@ -265,6 +265,7 @@ void PackLinuxElf32::pack3(OutputFile *fo, Filter &ft)
|
|||
}
|
||||
if (off_init) { // change DT_INIT.d_val
|
||||
fo->seek(off_init, SEEK_SET);
|
||||
va_init |= (Elf32_Ehdr::EM_ARM==e_machine);
|
||||
unsigned word; set_te32(&word, va_init);
|
||||
fo->rewrite(&word, sizeof(word));
|
||||
fo->seek(0, SEEK_END);
|
||||
|
@ -922,7 +923,7 @@ static const
|
|||
static const
|
||||
#include "stub/armel-eabi-linux.elf-fold.h"
|
||||
static const
|
||||
#include "stub/armel-eabi-linux.shlib-init.h"
|
||||
#include "stub/thumb-eabi-linux.shlib-init.h"
|
||||
|
||||
static const
|
||||
#include "stub/arm-linux.elf-entry.h"
|
||||
|
@ -953,7 +954,7 @@ PackLinuxElf32armLe::buildLoader(Filter const *ft)
|
|||
|
||||
if (0!=xct_off) { // shared library
|
||||
buildLinuxLoader(
|
||||
stub_armel_eabi_linux_shlib_init, sizeof(stub_armel_eabi_linux_shlib_init),
|
||||
stub_thumb_eabi_linux_shlib_init, sizeof(stub_thumb_eabi_linux_shlib_init),
|
||||
NULL, 0, ft );
|
||||
return;
|
||||
}
|
||||
|
@ -1673,9 +1674,6 @@ void PackLinuxElf32::pack1(OutputFile */*fo*/, Filter &/*ft*/)
|
|||
while (x>>=1) {
|
||||
++lg2_page;
|
||||
}
|
||||
if (hatch_off < 16 && Elf32_Ehdr::EM_ARM==e_machine) {
|
||||
hatch_off = get_te32(&phdr->p_offset) + get_te32(&phdr->p_memsz);
|
||||
}
|
||||
}
|
||||
}
|
||||
page_size = 1u<<lg2_page;
|
||||
|
@ -2278,6 +2276,10 @@ void PackLinuxElf32::pack4(OutputFile *fo, Filter &ft)
|
|||
ehdri.e_ident[13] = 0x80;
|
||||
ehdri.e_ident[14] = 0x61; // POPA
|
||||
ehdri.e_ident[15] = 0xc3; // RET
|
||||
if (Elf32_Ehdr::EM_ARM==e_machine) {
|
||||
set_te16(&ehdri.e_ident[12], 0xdf00); // swi 0
|
||||
set_te16(&ehdri.e_ident[14], 0xbdff); // pop {all regs}
|
||||
}
|
||||
fo->rewrite(&ehdri, sizeof(ehdri));
|
||||
fo->rewrite(phdri, e_phnum * sizeof(*phdri));
|
||||
}
|
||||
|
|
|
@ -115,6 +115,7 @@ STUBS += powerpc-linux.elf-entry.h
|
|||
STUBS += powerpc-linux.elf-fold.h
|
||||
STUBS += powerpc-linux.kernel.vmlinux.h
|
||||
STUBS += powerpc-linux.kernel.vmlinux-head.h
|
||||
STUBS += thumb-eabi-linux.shlib-init.h
|
||||
endif
|
||||
|
||||
|
||||
|
@ -394,6 +395,23 @@ armel-eabi-linux.shlib%.h : $(srcdir)/src/$$T.S
|
|||
$(call tc,bin2h-c) tmp/$T.bin $@
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // thumb-eabi-linux.shlib
|
||||
# ************************************************************************/
|
||||
|
||||
thumb-eabi-linux.shlib%.h : tc_list = thumb-eabi-linux.elf armel-eabi-linux.elf default
|
||||
thumb-eabi-linux.shlib%.h : tc_bfdname = elf32-littlearm
|
||||
|
||||
tc.armel-eabi-linux.elf.gcc = arm-linux-gcc-4.1.0 -march=armv5t -nostdinc -MMD -MT $@
|
||||
tc.armel-eabi-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||
tc.armel-eabi-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror
|
||||
|
||||
thumb-eabi-linux.shlib%.h : $(srcdir)/src/$$T.S
|
||||
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||
$(call tc,f-embed_objinfo,tmp/$T.bin)
|
||||
$(call tc,bin2h-c) tmp/$T.bin $@
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // arm-darwin.macho
|
||||
# ************************************************************************/
|
||||
|
|
2
src/stub/src/thumb-eabi-linux.shlib-init.S
Normal file
2
src/stub/src/thumb-eabi-linux.shlib-init.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#define ARMEL_EABI4 1
|
||||
#include "thumb-linux.shlib-init.S"
|
490
src/stub/src/thumb-linux.shlib-init.S
Normal file
490
src/stub/src/thumb-linux.shlib-init.S
Normal file
|
@ -0,0 +1,490 @@
|
|||
/* thumb-linux.shlib-init.S -- Linux Elf shared library init & decompressor
|
||||
*
|
||||
* This file is part of the UPX executable compressor.
|
||||
*
|
||||
* Copyright (C) 1996-2009 Markus Franz Xaver Johannes Oberhumer
|
||||
* Copyright (C) 1996-2009 Laszlo Molnar
|
||||
* Copyright (C) 2000-2009 John F. Reiser
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* UPX and the UCL library are free software; you can redistribute them
|
||||
* and/or modify them under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING.
|
||||
* If not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
* <markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||
*
|
||||
* John F. Reiser
|
||||
* <jreiser@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
#define ARM_OLDABI 1
|
||||
#include "arch/arm/v5a/macros.S"
|
||||
|
||||
#define bkpt .long 0xe7f001f0 /* reserved instr; Linux GNU eabi breakpoint */
|
||||
#define bkpt_th .short 0xde01 /* reserved instr; Linux GNU eabi breakpoint */
|
||||
sz_Elf32_Ehdr = 13*4
|
||||
sz_Elf32_Phdr = 8*4
|
||||
|
||||
sz_b_info= 12
|
||||
sz_unc= 0
|
||||
sz_cpr= 4
|
||||
b_method= 8
|
||||
sz_l_info= 12
|
||||
sz_p_info= 12
|
||||
|
||||
PROT_READ= 1
|
||||
PROT_WRITE= 2
|
||||
PROT_EXEC= 4
|
||||
|
||||
MAP_PRIVATE= 2
|
||||
MAP_FIXED= 0x10
|
||||
MAP_ANONYMOUS= 0x20
|
||||
|
||||
PAGE_SHIFT= 12
|
||||
PAGE_MASK= (~0<<PAGE_SHIFT)
|
||||
PAGE_SIZE= -PAGE_MASK
|
||||
|
||||
__NR_exit = 1 + __NR_SYSCALL_BASE
|
||||
__NR_write = 4 + __NR_SYSCALL_BASE
|
||||
__NR_mmap64 = 0xc0 + __NR_SYSCALL_BASE
|
||||
__NR_mprotect =125 + __NR_SYSCALL_BASE
|
||||
__NR_munmap = 91 + __NR_SYSCALL_BASE
|
||||
|
||||
__ARM_NR_BASE = 0xf0000 + __NR_SYSCALL_BASE
|
||||
__ARM_NR_cacheflush = 2 + __ARM_NR_BASE
|
||||
|
||||
#define arg1 r0
|
||||
#define arg2 r1
|
||||
#define arg3 r2
|
||||
#define arg4 r3
|
||||
#define arg5 r4
|
||||
|
||||
#define edi r0
|
||||
#define esi r1
|
||||
#define edx r2
|
||||
#define tmp r3
|
||||
#define eax r4
|
||||
#define ecx r5
|
||||
|
||||
#define SP(d) sp,#4*(_-d) /* stack addressing mode */
|
||||
|
||||
.macro thumb_sys7t N
|
||||
#if defined(ARMEL_EABI4)
|
||||
mov r7,#\N
|
||||
swi 0
|
||||
#elif defined(ARM_OLDABI)
|
||||
blx x\N
|
||||
#else
|
||||
error \N // ARM_OLDABI, ARMEL_EABI4, ARMEL_DARWIN ?
|
||||
#endif
|
||||
|
||||
.endm
|
||||
|
||||
.macro call4 label
|
||||
.balign 4
|
||||
bl \label
|
||||
.endm
|
||||
|
||||
.macro push_ reg
|
||||
push {\reg}
|
||||
_= 1+_ // one more word on stack
|
||||
.endm
|
||||
|
||||
.macro pop_ reg
|
||||
pop {\reg}
|
||||
_=-1+_ // one less word on stack
|
||||
.endm
|
||||
|
||||
//#define lodsl ldr eax,[esi],#4
|
||||
#define lodslu bl get4u
|
||||
|
||||
section ELFMAINX
|
||||
// .long offset(.) // detect relocation
|
||||
// .long offset(user DT_INIT)
|
||||
// .long offset(escape_hatch)
|
||||
// .long offset({p_info; b_info; compressed data})
|
||||
|
||||
.code 16 //; .balign 4
|
||||
.real_start_ofELFMAINX:
|
||||
.thumb_func
|
||||
_start: .globl _start
|
||||
nop //; bkpt_th // for debugging
|
||||
push {r0,r1,r2,r3,r4,r5,r6,r7,lr}
|
||||
_=9
|
||||
o_uinit= 1 // lr
|
||||
adr tmp,here; mov esi,#4*4 + here - _start
|
||||
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
|
||||
// reloc &hatch (thumb mode) for step 10
|
||||
ldr tmp,[esi,#2*4]; add tmp,ecx; add tmp,#1
|
||||
mov esi,#sz_p_info
|
||||
add esi,edi // &b_info
|
||||
|
||||
push_ tmp
|
||||
o_hatch=_ // 10
|
||||
sub sp,#2*4; _=2+_ // param space: munmap temp pages step 9
|
||||
p_unmap=_ // 12
|
||||
|
||||
push_ lr
|
||||
o_lr=_ // 13
|
||||
ldr eax,[esi,#sz_cpr]; add esi,#sz_b_info
|
||||
add esi,eax // skip unpack helper block
|
||||
|
||||
lodslu // eax=dstlen
|
||||
lsl tmp,edi,#(32-PAGE_SHIFT)
|
||||
lsr tmp,tmp,#(32-PAGE_SHIFT) // tmp= fragment
|
||||
add eax,tmp; push_ eax // params: mprotect restored pages step 8
|
||||
sub edi,tmp; push_ edi
|
||||
p_mprot=_ // 15
|
||||
sub eax,tmp // dstlen
|
||||
add edi,tmp // dst
|
||||
lsr tmp,tmp,#2; push_ tmp // w_fragment
|
||||
o_wfrag=_ // 16
|
||||
|
||||
.balign 4
|
||||
call4 L610
|
||||
.arm
|
||||
f_unfilter: // (char *ptr, uint len, uint cto, uint fid)
|
||||
#define ptr r0
|
||||
#define len r1
|
||||
#define cto r2
|
||||
#define fid r3
|
||||
|
||||
#define t1 r2
|
||||
#define t2 r3
|
||||
|
||||
#ifndef FILTER_ID /*{*/
|
||||
#define FILTER_ID 0x50 /* little-endian */
|
||||
#endif /*}*/
|
||||
and fid,fid,#0xff
|
||||
cmp fid,#FILTER_ID // last use of fid
|
||||
bxne lr // no-op if not filter 0x50
|
||||
|
||||
movs len,len,lsr #2 // word count
|
||||
cmpne ptr,#0
|
||||
bxeq lr // no-op if either len or ptr is 0
|
||||
|
||||
top_unf:
|
||||
sub len,len,#1
|
||||
ldr t1,[ptr,len,lsl #2]
|
||||
and t2,t1,#0x0f<<24
|
||||
cmp t2, #0x0b<<24; bne tst_unf // not 'bl' subroutine call
|
||||
and t2,t1,#0xff<<24 // all the non-displacement bits
|
||||
sub t1,t1,len // convert to word-relative displacement
|
||||
bic t1,t1,#0xff<<24 // restrict to displacement field
|
||||
orr t1,t1,t2 // re-combine
|
||||
str t1,[ptr,len,lsl #2]
|
||||
tst_unf:
|
||||
cmp len,#0
|
||||
bne top_unf
|
||||
ret
|
||||
|
||||
#undef ptr
|
||||
#undef len
|
||||
#undef cto
|
||||
#undef fid
|
||||
|
||||
#undef t1
|
||||
#undef t2
|
||||
|
||||
.thumb
|
||||
.thumb_func
|
||||
L610:
|
||||
mov tmp,lr; sub tmp,#1; push_ tmp // &f_unfilter (ARM mode)
|
||||
o_unflt=_ // 17
|
||||
ldrb tmp,[esi,#b_method-4+1]; push_ tmp // ftid
|
||||
ldrb tmp,[esi,#b_method-4+2]; push_ tmp // cto8
|
||||
push_ eax // dstlen also for unfilter step 7
|
||||
push_ edi // dst param for unfilter step 7
|
||||
p_unflt=_ // 21
|
||||
|
||||
lodslu; mov ecx,eax // ecx= srclen
|
||||
lodslu; push_ eax // method,filter,cto,junk
|
||||
|
||||
call4 L710
|
||||
.arm
|
||||
f_decompress:
|
||||
#define LINUX_ARM_CACHEFLUSH 1
|
||||
|
||||
section NRV_HEAD
|
||||
// empty
|
||||
section NRV_TAIL
|
||||
// empty
|
||||
|
||||
section NRV2E
|
||||
#include "arch/arm/v4a/nrv2e_d8.S"
|
||||
|
||||
section NRV2D
|
||||
#include "arch/arm/v4a/nrv2d_d8.S"
|
||||
|
||||
section NRV2B
|
||||
#include "arch/arm/v4a/nrv2b_d8.S"
|
||||
|
||||
#include "arch/arm/v4a/lzma_d.S"
|
||||
|
||||
section ELFMAINY
|
||||
end_decompress: .globl end_decompress
|
||||
|
||||
msg_SELinux:
|
||||
mov r2,#L71 - L70 // length
|
||||
adr r1,L70 // message text
|
||||
mov r0,#2 // fd stderr
|
||||
#if defined(ARMEL_EABI4) /*{*/
|
||||
mov r7,#__NR_write
|
||||
swi 0
|
||||
#else /*}{*/
|
||||
swi __NR_write
|
||||
#endif /*}*/
|
||||
die:
|
||||
mov r0,#127
|
||||
#if defined(ARMEL_EABI4) /*{*/
|
||||
mov r7,#__NR_exit
|
||||
swi 0
|
||||
#else /*}{*/
|
||||
swi __NR_exit
|
||||
#endif /*}*/
|
||||
L70:
|
||||
.asciz "PROT_EXEC|PROT_WRITE failed.\n"
|
||||
L71:
|
||||
/* IDENTSTR goes here */
|
||||
|
||||
section ELFMAINZ
|
||||
.code 16; .balign 2
|
||||
.real_start_ofELFMAINZ:
|
||||
|
||||
.thumb_func
|
||||
L710:
|
||||
.real_start_ofL710:
|
||||
|
||||
// 1. allocate temporary pages
|
||||
// 2. copy to temporary pages:
|
||||
// fragment of page below dst; compressed src;
|
||||
// decompress+unfilter; supervise
|
||||
// 3. mmap destination pages for decompressed data
|
||||
// 4. create escape hatch
|
||||
// 5. jump to temporary pages
|
||||
// 6. uncompress
|
||||
// 7. unfilter
|
||||
// 8. mprotect decompressed pages
|
||||
// 9 setup args for unmap of temp pages
|
||||
// 10. jump to escape hatch
|
||||
// 11. unmap temporary pages
|
||||
// 12. goto user DT_INIT
|
||||
|
||||
mov tmp,lr; sub tmp,#1; push_ tmp // &f_decompress (ARM mode)
|
||||
o_uncpr=_ // 23
|
||||
add tmp,SP(p_unflt)+1*4; push_ tmp // &dstlen
|
||||
push_ edi // dst
|
||||
push_ ecx // srclen
|
||||
push_ esi // src; arglist ready for decompress step 6
|
||||
p_uncpr=_ // 27
|
||||
|
||||
mov tmp,#3
|
||||
and tmp,esi // length of prefix alignment
|
||||
add ecx,#3 // allow suffix alignment
|
||||
add ecx,tmp // prefix increases byte length
|
||||
lsr ecx,#2 // w_srclen
|
||||
ldr tmp,[SP(o_wfrag)]; add edx,tmp,ecx // w_srclen + w_frag
|
||||
ldr tmp,[SP(o_uncpr)]; bl wlen_subr; add edx,ecx
|
||||
ldr tmp,[SP(o_unflt)]; bl wlen_subr; add edx,ecx
|
||||
|
||||
call4 L220
|
||||
SAVE_=_
|
||||
supervise: // moved at runtime before being executed
|
||||
// Allocate pages for result of decompressing.
|
||||
// These replace the compressed source and the following hole.
|
||||
mov arg5,#0; mvn arg5,arg5 // -1; cater to *BSD for fd of MAP_ANON
|
||||
mov arg4,#MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED
|
||||
mov arg3,#PROT_READ|PROT_WRITE
|
||||
ldr arg2,[SP(p_mprot)+4] // dstlen
|
||||
ldr arg1,[SP(p_mprot) ] // dst
|
||||
mov r6,arg1 // required result
|
||||
thumb_sys7t __NR_mmap64; cmp r0,r6; beq 0f; bkpt_th; 0:
|
||||
|
||||
// Restore fragment of page below dst
|
||||
ldr ecx,[SP(o_wfrag)]
|
||||
//mov edi,r0 // NOP: edi==r0
|
||||
ldr esi,[SP(p_unmap)]
|
||||
bl movsl
|
||||
|
||||
pop {arg1,arg2,arg3,arg4, eax}
|
||||
_=-5+_ // 22
|
||||
blx eax // decompress
|
||||
pop_ tmp // toss arg5
|
||||
|
||||
//p_unflt // 21
|
||||
pop {arg1,arg2,arg3,arg4, eax}
|
||||
_=-5+_ // 16
|
||||
tst arg4,arg4; beq 0f // 0==ftid ==> no filter
|
||||
blx eax // unfilter
|
||||
0:
|
||||
add sp,#4 // toss w_fragment
|
||||
_=-1+_ // 15
|
||||
ldr arg1,[sp,#0*4] // lo(dst)
|
||||
ldr arg2,[sp,#1*4] // len
|
||||
add arg2,arg1 // hi(dst)
|
||||
bl x__ARM_NR_cacheflush
|
||||
|
||||
//p_mprot // 15
|
||||
pop {arg1,arg2, tmp}; mov lr,tmp
|
||||
_=-3+_ // 12
|
||||
mov arg3,#PROT_READ|PROT_EXEC
|
||||
thumb_sys7t __NR_mprotect
|
||||
|
||||
//p_unmap
|
||||
.if __NR_munmap <= 0xff
|
||||
mov r7,#__NR_munmap
|
||||
.else
|
||||
mov r7,#__NR_munmap>>16
|
||||
lsl r7,#16
|
||||
add r7,#__NR_munmap - ((__NR_munmap>>16)<<16)
|
||||
.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
|
||||
|
||||
.thumb_func
|
||||
movsl_subr:
|
||||
.real_start_ofmovsl_subr:
|
||||
push {lr}; mov tmp,esi; bl wlen_subr
|
||||
pop {tmp}; mov lr,tmp
|
||||
// FALL THROUGH to the part of 'movsl' that trims to a multiple of 8 words.
|
||||
// 7/8 of the time this is faster; 1/8 of the time it's slower.
|
||||
9:
|
||||
ldr tmp,[esi,#0]; add esi,#4
|
||||
str tmp,[edi,#0]; add edi,#4
|
||||
sub ecx,#1
|
||||
.thumb_func
|
||||
movsl:
|
||||
.real_start_ofmovsl:
|
||||
mov tmp,#7; tst ecx,tmp; bne 9b
|
||||
lsr ecx,#3; beq 9f
|
||||
.balign 4; bx pc; nop // enter ARM mode
|
||||
.arm
|
||||
stmdb sp!,{r2,r4,r6, r7,r8,r9} // tmp===r3, ecx===r5
|
||||
7:
|
||||
ldmia esi!,{r2,r3,r4,r6, r7,r8,r9,r12}; subs ecx,ecx,#1
|
||||
stmia edi!,{r2,r3,r4,r6, r7,r8,r9,r12}; bne 7b
|
||||
ldmia sp!,{r2,r4,r6, r7,r8,r9}
|
||||
9:
|
||||
ret
|
||||
|
||||
#if !defined(ARMEL_EABI4) /*{*/
|
||||
.arm
|
||||
.balign 4
|
||||
x__NR_mmap:
|
||||
do_sys7t __NR_mmap64
|
||||
bx lr
|
||||
x__NR_munmap:
|
||||
do_sys7t __NR_munmap
|
||||
bx lr
|
||||
x__NR_mprotect:
|
||||
do_sys7t __NR_mprotect
|
||||
bx lr
|
||||
.thumb
|
||||
#endif /*}*/
|
||||
|
||||
.thumb_func
|
||||
x__ARM_NR_cacheflush:
|
||||
.real_start_ofx__ARM_NR_cacheflush:
|
||||
mov arg3,#0
|
||||
mov r7,#__ARM_NR_BASE>>16
|
||||
lsl r7,#16
|
||||
add r7,# __ARM_NR_cacheflush - __ARM_NR_BASE
|
||||
swi 0
|
||||
bx lr
|
||||
|
||||
.thumb_func
|
||||
L220:
|
||||
.real_start_ofL220:
|
||||
_=SAVE_ // 27
|
||||
mov tmp,lr; sub tmp,#1; push_ tmp // &supervise
|
||||
o_super=_ // 28
|
||||
bl wlen_subr; add edx,ecx // wlen_supervise
|
||||
lsl arg2,edx,#2 // convert to bytes
|
||||
|
||||
// Allocate pages to hold temporary copy.
|
||||
mov arg5,#0; mvn arg5,arg5 // -1; cater to *BSD for fd of MAP_ANON
|
||||
mov arg4,#MAP_PRIVATE|MAP_ANONYMOUS
|
||||
mov arg3,#PROT_READ|PROT_WRITE|PROT_EXEC
|
||||
str arg2,[SP(p_unmap)+1*4] // length to unmap
|
||||
mov arg1,#0 // any addr
|
||||
thumb_sys7t __NR_mmap64; asr tmp,r0,#12; add tmp,#1; bne 0f; bkpt_th; 0:
|
||||
str r0,[SP(p_unmap)] // address to unmap
|
||||
|
||||
ldr esi,[SP(p_mprot)]
|
||||
//mov edi,r0 // edi= dst NOP: edi==r0
|
||||
ldr ecx,[SP(o_wfrag)] // w_fragment
|
||||
bl movsl // copy the fragment
|
||||
|
||||
ldr esi,[SP(p_uncpr)+0*4] // src
|
||||
ldr ecx,[SP(p_uncpr)+1*4] // len
|
||||
mov tmp,#3
|
||||
and tmp,esi // length of prefix alignment
|
||||
sub esi,tmp // down to word aligned
|
||||
add ecx,tmp // prefix increases byte length
|
||||
add tmp,edi // skip prefix at destination
|
||||
str tmp,[SP(p_uncpr)+0*4] // dst
|
||||
add ecx,#3 // round up to full words
|
||||
lsr ecx,#2
|
||||
bl movsl // copy all aligned words that contain compressed data
|
||||
|
||||
mov edx,edi // lo(dst) of copied code
|
||||
|
||||
ldr esi,[SP(o_uncpr)]
|
||||
str edi,[SP(o_uncpr)]
|
||||
bl movsl_subr // copy decompressor (FIXME: must be ARM mode)
|
||||
|
||||
ldr esi,[SP(o_unflt)]
|
||||
str edi,[SP(o_unflt)]
|
||||
bl movsl_subr // copy unfilter (FIXME: must be ARM mode)
|
||||
|
||||
pop_ esi // &supervise
|
||||
add r7,edi,#1 // &copied (thumb mode)
|
||||
bl movsl_subr // copy supervisor
|
||||
|
||||
mov arg2,edi // hi(dst) of copied code
|
||||
mov arg1,edx // lo(dst) of copied code
|
||||
mov lr,r7 // return address for ...
|
||||
b x__ARM_NR_cacheflush // call with continuation return
|
||||
|
||||
get4u:
|
||||
ldrb eax,[esi,#3];
|
||||
ldrb tmp,[esi,#2]; lsl eax,#8; orr eax,tmp
|
||||
ldrb tmp,[esi,#1]; lsl eax,#8; orr eax,tmp
|
||||
ldrb tmp,[esi,#0]; lsl eax,#8; orr eax,tmp
|
||||
add esi,#4
|
||||
ret
|
||||
|
||||
wlen_subr: // Out: ecx= nwords of inline subr at *tmp
|
||||
sub tmp,#4
|
||||
ldrh ecx,[tmp,#0]; lsl ecx,#32-11; lsr ecx,#32-11-11 // hi(disp)
|
||||
ldrh tmp,[tmp,#2]; lsl tmp,#32-11; lsr tmp,#32-11- 0 // lo(disp)
|
||||
add ecx,tmp // disp
|
||||
add ecx,#1+1 // disp omits 1 word; prepare to round
|
||||
lsr ecx,#1 // round up to whole 32-bit words
|
||||
ret
|
||||
|
||||
/*__XTHEENDX__*/
|
||||
/*
|
||||
vi:ts=8:et:nowrap
|
||||
*/
|
1017
src/stub/thumb-eabi-linux.shlib-init.h
Normal file
1017
src/stub/thumb-eabi-linux.shlib-init.h
Normal file
File diff suppressed because it is too large
Load Diff
268
src/stub/tmp/thumb-eabi-linux.shlib-init.bin.dump
Normal file
268
src/stub/tmp/thumb-eabi-linux.shlib-init.bin.dump
Normal file
|
@ -0,0 +1,268 @@
|
|||
file format elf32-littlearm
|
||||
|
||||
Sections:
|
||||
Idx Name Size VMA LMA File off Algn Flags
|
||||
0 ELFMAINX 000000bc 00000000 00000000 00000034 2**2 CONTENTS, RELOC, READONLY
|
||||
1 NRV_HEAD 00000000 00000000 00000000 000000f0 2**0 CONTENTS, READONLY
|
||||
2 NRV_TAIL 00000000 00000000 00000000 000000f0 2**0 CONTENTS, READONLY
|
||||
3 NRV2E 0000013c 00000000 00000000 000000f0 2**0 CONTENTS, RELOC, READONLY
|
||||
4 NRV2D 00000128 00000000 00000000 0000022c 2**0 CONTENTS, RELOC, READONLY
|
||||
5 NRV2B 000000ec 00000000 00000000 00000354 2**0 CONTENTS, RELOC, READONLY
|
||||
6 LZMA_ELF00 000000b8 00000000 00000000 00000440 2**0 CONTENTS, RELOC, READONLY
|
||||
7 LZMA_DEC20 00000938 00000000 00000000 000004f8 2**0 CONTENTS, RELOC, READONLY
|
||||
8 LZMA_DEC10 00000478 00000000 00000000 00000e30 2**0 CONTENTS, RELOC, READONLY
|
||||
9 LZMA_DEC30 00000000 00000000 00000000 000012a8 2**0 CONTENTS, READONLY
|
||||
10 ELFMAINY 0000003e 00000000 00000000 000012a8 2**0 CONTENTS, READONLY
|
||||
11 ELFMAINZ 00000160 00000000 00000000 000012e8 2**2 CONTENTS, RELOC, READONLY
|
||||
SYMBOL TABLE:
|
||||
00000000 l d ELFMAINX 00000000 ELFMAINX
|
||||
00000000 l ELFMAINX 00000000 .real_start_ofELFMAINX
|
||||
00000000 l d NRV2E 00000000 NRV2E
|
||||
00000000 l d NRV2D 00000000 NRV2D
|
||||
00000000 l d NRV2B 00000000 NRV2B
|
||||
00000000 l d LZMA_ELF00 00000000 LZMA_ELF00
|
||||
00000000 l d LZMA_DEC20 00000000 LZMA_DEC20
|
||||
00000000 l d LZMA_DEC10 00000000 LZMA_DEC10
|
||||
00000000 l d LZMA_DEC30 00000000 LZMA_DEC30
|
||||
00000000 l d ELFMAINZ 00000000 ELFMAINZ
|
||||
00000000 l ELFMAINZ 00000000 .real_start_ofELFMAINZ
|
||||
00000000 l d NRV_HEAD 00000000 NRV_HEAD
|
||||
00000000 l d NRV_TAIL 00000000 NRV_TAIL
|
||||
00000000 l d ELFMAINY 00000000 ELFMAINY
|
||||
00000000 g ELFMAINX 00000000 _start
|
||||
00000000 g F NRV2E 0000013c ucl_nrv2e_decompress_8
|
||||
00000000 g F NRV2D 00000128 ucl_nrv2d_decompress_8
|
||||
00000000 g F NRV2B 000000ec ucl_nrv2b_decompress_8
|
||||
00000000 g LZMA_DEC10 00000000 LzmaDecode
|
||||
00000000 g ELFMAINY 00000000 end_decompress
|
||||
|
||||
RELOCATION RECORDS FOR [ELFMAINX]:
|
||||
OFFSET TYPE VALUE
|
||||
00000030 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
00000048 R_ARM_THM_CALL .real_start_ofELFMAINX
|
||||
00000074 R_ARM_PC24 ELFMAINX
|
||||
00000090 R_ARM_PC24 ELFMAINX
|
||||
000000aa R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
000000b0 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
000000b8 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
|
||||
RELOCATION RECORDS FOR [NRV2E]:
|
||||
OFFSET TYPE VALUE
|
||||
00000010 R_ARM_PC24 NRV2E
|
||||
0000006c R_ARM_PC24 NRV2E
|
||||
00000070 R_ARM_PC24 NRV2E
|
||||
00000078 R_ARM_PC24 NRV2E
|
||||
00000084 R_ARM_PC24 NRV2E
|
||||
00000090 R_ARM_PC24 NRV2E
|
||||
0000009c R_ARM_PC24 NRV2E
|
||||
000000a0 R_ARM_PC24 NRV2E
|
||||
000000ac R_ARM_PC24 NRV2E
|
||||
000000bc R_ARM_PC24 NRV2E
|
||||
000000c4 R_ARM_PC24 NRV2E
|
||||
000000c8 R_ARM_PC24 NRV2E
|
||||
000000d0 R_ARM_PC24 NRV2E
|
||||
000000d4 R_ARM_PC24 NRV2E
|
||||
000000e0 R_ARM_PC24 NRV2E
|
||||
000000e4 R_ARM_PC24 NRV2E
|
||||
000000ec R_ARM_PC24 NRV2E
|
||||
000000f8 R_ARM_PC24 NRV2E
|
||||
000000fc R_ARM_PC24 NRV2E
|
||||
00000104 R_ARM_PC24 NRV2E
|
||||
0000010c R_ARM_PC24 NRV2E
|
||||
00000134 R_ARM_PC24 NRV2E
|
||||
00000138 R_ARM_PC24 NRV2E
|
||||
|
||||
RELOCATION RECORDS FOR [NRV2D]:
|
||||
OFFSET TYPE VALUE
|
||||
00000010 R_ARM_PC24 NRV2D
|
||||
0000006c R_ARM_PC24 NRV2D
|
||||
00000070 R_ARM_PC24 NRV2D
|
||||
00000078 R_ARM_PC24 NRV2D
|
||||
00000084 R_ARM_PC24 NRV2D
|
||||
00000090 R_ARM_PC24 NRV2D
|
||||
0000009c R_ARM_PC24 NRV2D
|
||||
000000a0 R_ARM_PC24 NRV2D
|
||||
000000ac R_ARM_PC24 NRV2D
|
||||
000000bc R_ARM_PC24 NRV2D
|
||||
000000c4 R_ARM_PC24 NRV2D
|
||||
000000cc R_ARM_PC24 NRV2D
|
||||
000000d8 R_ARM_PC24 NRV2D
|
||||
000000e0 R_ARM_PC24 NRV2D
|
||||
000000ec R_ARM_PC24 NRV2D
|
||||
000000f8 R_ARM_PC24 NRV2D
|
||||
000000fc R_ARM_PC24 NRV2D
|
||||
00000120 R_ARM_PC24 NRV2D
|
||||
00000124 R_ARM_PC24 NRV2D
|
||||
|
||||
RELOCATION RECORDS FOR [NRV2B]:
|
||||
OFFSET TYPE VALUE
|
||||
00000010 R_ARM_PC24 NRV2B
|
||||
00000070 R_ARM_PC24 NRV2B
|
||||
00000078 R_ARM_PC24 NRV2B
|
||||
0000007c R_ARM_PC24 NRV2B
|
||||
0000008c R_ARM_PC24 NRV2B
|
||||
00000090 R_ARM_PC24 NRV2B
|
||||
00000094 R_ARM_PC24 NRV2B
|
||||
000000a0 R_ARM_PC24 NRV2B
|
||||
000000b0 R_ARM_PC24 NRV2B
|
||||
000000b4 R_ARM_PC24 NRV2B
|
||||
000000bc R_ARM_PC24 NRV2B
|
||||
000000c4 R_ARM_PC24 NRV2B
|
||||
000000c8 R_ARM_PC24 NRV2B
|
||||
000000e4 R_ARM_PC24 NRV2B
|
||||
000000e8 R_ARM_PC24 NRV2B
|
||||
|
||||
RELOCATION RECORDS FOR [LZMA_ELF00]:
|
||||
OFFSET TYPE VALUE
|
||||
00000008 R_ARM_PC24 LZMA_DEC30
|
||||
0000004c R_ARM_PC24 LZMA_ELF00
|
||||
00000080 R_ARM_PC24 LZMA_ELF00
|
||||
|
||||
RELOCATION RECORDS FOR [LZMA_DEC20]:
|
||||
OFFSET TYPE VALUE
|
||||
00000074 R_ARM_PC24 LZMA_DEC20
|
||||
00000090 R_ARM_PC24 LZMA_DEC20
|
||||
000000b8 R_ARM_PC24 LZMA_DEC20
|
||||
000000cc R_ARM_PC24 LZMA_DEC20
|
||||
000000f4 R_ARM_PC24 LZMA_DEC20
|
||||
00000100 R_ARM_PC24 LZMA_DEC20
|
||||
00000108 R_ARM_PC24 LZMA_DEC20
|
||||
00000144 R_ARM_PC24 LZMA_DEC20
|
||||
00000190 R_ARM_PC24 LZMA_DEC20
|
||||
000001cc R_ARM_PC24 LZMA_DEC20
|
||||
000001d8 R_ARM_PC24 LZMA_DEC20
|
||||
00000204 R_ARM_PC24 LZMA_DEC20
|
||||
00000218 R_ARM_PC24 LZMA_DEC20
|
||||
00000220 R_ARM_PC24 LZMA_DEC20
|
||||
00000234 R_ARM_PC24 LZMA_DEC20
|
||||
0000023c R_ARM_PC24 LZMA_DEC20
|
||||
00000240 R_ARM_PC24 LZMA_DEC20
|
||||
0000024c R_ARM_PC24 LZMA_DEC20
|
||||
00000258 R_ARM_PC24 LZMA_DEC20
|
||||
000002a4 R_ARM_PC24 LZMA_DEC20
|
||||
000002c8 R_ARM_PC24 LZMA_DEC20
|
||||
000002e8 R_ARM_PC24 LZMA_DEC20
|
||||
00000304 R_ARM_PC24 LZMA_DEC20
|
||||
0000030c R_ARM_PC24 LZMA_DEC20
|
||||
0000033c R_ARM_PC24 LZMA_DEC20
|
||||
00000388 R_ARM_PC24 LZMA_DEC20
|
||||
000003a0 R_ARM_PC24 LZMA_DEC20
|
||||
000003a8 R_ARM_PC24 LZMA_DEC20
|
||||
000003cc R_ARM_PC24 LZMA_DEC20
|
||||
000003e0 R_ARM_PC24 LZMA_DEC20
|
||||
000003e8 R_ARM_PC24 LZMA_DEC20
|
||||
00000424 R_ARM_PC24 LZMA_DEC20
|
||||
00000438 R_ARM_PC24 LZMA_DEC20
|
||||
0000046c R_ARM_PC24 LZMA_DEC20
|
||||
00000484 R_ARM_PC24 LZMA_DEC20
|
||||
0000048c R_ARM_PC24 LZMA_DEC20
|
||||
000004b0 R_ARM_PC24 LZMA_DEC20
|
||||
000004d4 R_ARM_PC24 LZMA_DEC20
|
||||
000004ec R_ARM_PC24 LZMA_DEC20
|
||||
000004f4 R_ARM_PC24 LZMA_DEC20
|
||||
00000518 R_ARM_PC24 LZMA_DEC20
|
||||
0000053c R_ARM_PC24 LZMA_DEC20
|
||||
00000598 R_ARM_PC24 LZMA_DEC20
|
||||
000005a0 R_ARM_PC24 LZMA_DEC20
|
||||
000005c0 R_ARM_PC24 LZMA_DEC20
|
||||
000005e4 R_ARM_PC24 LZMA_DEC20
|
||||
000005fc R_ARM_PC24 LZMA_DEC20
|
||||
00000604 R_ARM_PC24 LZMA_DEC20
|
||||
00000624 R_ARM_PC24 LZMA_DEC20
|
||||
00000648 R_ARM_PC24 LZMA_DEC20
|
||||
00000680 R_ARM_PC24 LZMA_DEC20
|
||||
0000068c R_ARM_PC24 LZMA_DEC20
|
||||
000006d0 R_ARM_PC24 LZMA_DEC20
|
||||
000006ec R_ARM_PC24 LZMA_DEC20
|
||||
0000071c R_ARM_PC24 LZMA_DEC20
|
||||
00000728 R_ARM_PC24 LZMA_DEC20
|
||||
0000076c R_ARM_PC24 LZMA_DEC20
|
||||
0000077c R_ARM_PC24 LZMA_DEC20
|
||||
0000079c R_ARM_PC24 LZMA_DEC20
|
||||
000007b8 R_ARM_PC24 LZMA_DEC20
|
||||
000007c4 R_ARM_PC24 LZMA_DEC20
|
||||
000007d0 R_ARM_PC24 LZMA_DEC20
|
||||
000007f4 R_ARM_PC24 LZMA_DEC20
|
||||
00000820 R_ARM_PC24 LZMA_DEC20
|
||||
0000082c R_ARM_PC24 LZMA_DEC20
|
||||
0000087c R_ARM_PC24 LZMA_DEC20
|
||||
00000888 R_ARM_PC24 LZMA_DEC20
|
||||
000008a0 R_ARM_PC24 LZMA_DEC20
|
||||
000008e8 R_ARM_PC24 LZMA_DEC20
|
||||
000008f4 R_ARM_PC24 LZMA_DEC20
|
||||
000008fc R_ARM_PC24 LZMA_DEC20
|
||||
00000904 R_ARM_PC24 LZMA_DEC20
|
||||
00000928 R_ARM_PC24 LZMA_DEC20
|
||||
|
||||
RELOCATION RECORDS FOR [LZMA_DEC10]:
|
||||
OFFSET TYPE VALUE
|
||||
00000078 R_ARM_PC24 LZMA_DEC10
|
||||
00000080 R_ARM_PC24 LZMA_DEC10
|
||||
00000088 R_ARM_PC24 LZMA_DEC10
|
||||
000000a8 R_ARM_PC24 LZMA_DEC10
|
||||
000000ac R_ARM_PC24 LZMA_DEC10
|
||||
000000e4 R_ARM_PC24 LZMA_DEC10
|
||||
00000100 R_ARM_PC24 LZMA_DEC10
|
||||
0000010c R_ARM_PC24 LZMA_DEC10
|
||||
00000114 R_ARM_PC24 LZMA_DEC10
|
||||
00000118 R_ARM_PC24 LZMA_DEC10
|
||||
00000120 R_ARM_PC24 LZMA_DEC10
|
||||
00000128 R_ARM_PC24 LZMA_DEC10
|
||||
00000144 R_ARM_PC24 LZMA_DEC10
|
||||
0000014c R_ARM_PC24 LZMA_DEC10
|
||||
00000150 R_ARM_PC24 LZMA_DEC10
|
||||
00000180 R_ARM_PC24 LZMA_DEC10
|
||||
00000188 R_ARM_PC24 LZMA_DEC10
|
||||
0000018c R_ARM_PC24 LZMA_DEC10
|
||||
0000019c R_ARM_PC24 LZMA_DEC10
|
||||
000001a0 R_ARM_PC24 LZMA_DEC10
|
||||
000001c0 R_ARM_PC24 LZMA_DEC10
|
||||
000001cc R_ARM_PC24 LZMA_DEC10
|
||||
000001d4 R_ARM_PC24 LZMA_DEC10
|
||||
000001dc R_ARM_PC24 LZMA_DEC10
|
||||
000001e4 R_ARM_PC24 LZMA_DEC10
|
||||
000001ec R_ARM_PC24 LZMA_DEC10
|
||||
00000228 R_ARM_PC24 LZMA_DEC10
|
||||
0000022c R_ARM_PC24 LZMA_DEC10
|
||||
00000244 R_ARM_PC24 LZMA_DEC10
|
||||
0000024c R_ARM_PC24 LZMA_DEC10
|
||||
00000250 R_ARM_PC24 LZMA_DEC10
|
||||
00000268 R_ARM_PC24 LZMA_DEC10
|
||||
00000284 R_ARM_PC24 LZMA_DEC10
|
||||
0000028c R_ARM_PC24 LZMA_DEC10
|
||||
000002a4 R_ARM_PC24 LZMA_DEC10
|
||||
000002c8 R_ARM_PC24 LZMA_DEC10
|
||||
000002d0 R_ARM_PC24 LZMA_DEC10
|
||||
000002dc R_ARM_PC24 LZMA_DEC10
|
||||
000002f4 R_ARM_PC24 LZMA_DEC10
|
||||
0000030c R_ARM_PC24 LZMA_DEC10
|
||||
00000314 R_ARM_PC24 LZMA_DEC10
|
||||
0000032c R_ARM_PC24 LZMA_DEC10
|
||||
00000350 R_ARM_PC24 LZMA_DEC10
|
||||
00000358 R_ARM_PC24 LZMA_DEC10
|
||||
00000370 R_ARM_PC24 LZMA_DEC10
|
||||
00000378 R_ARM_PC24 LZMA_DEC10
|
||||
0000039c R_ARM_PC24 LZMA_DEC10
|
||||
000003b0 R_ARM_PC24 LZMA_DEC10
|
||||
000003b8 R_ARM_PC24 LZMA_DEC10
|
||||
000003c8 R_ARM_PC24 LZMA_DEC10
|
||||
000003cc R_ARM_PC24 LZMA_DEC10
|
||||
00000400 R_ARM_PC24 LZMA_DEC10
|
||||
00000418 R_ARM_PC24 LZMA_DEC10
|
||||
00000440 R_ARM_PC24 LZMA_DEC10
|
||||
|
||||
RELOCATION RECORDS FOR [ELFMAINZ]:
|
||||
OFFSET TYPE VALUE
|
||||
00000020 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
00000028 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
00000030 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
00000050 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
0000006a R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
00000080 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
000000b0 R_ARM_PC24 ELFMAINZ
|
||||
000000ce R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
000000f4 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
0000010c R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
00000116 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
0000011e R_ARM_THM_CALL .real_start_ofELFMAINZ
|
||||
00000126 R_ARM_THM_CALL .real_start_ofELFMAINZ
|
Loading…
Reference in New Issue
Block a user