mirror of https://github.com/upx/upx.git
FIx MIPS stubs
modified: stub/Makefile modified: stub/src/arm.v4a-linux.elf-entry.S modified: stub/src/i386-linux.elf-main2.c modified: stub/src/upxfd_android.c modified: stub/src/upxfd_linux.c
This commit is contained in:
parent
5afe2af365
commit
877390a2ba
|
@ -286,8 +286,10 @@ define tc.default.f-embed_objinfo_without_xstrip
|
|||
chmod a-x $1
|
||||
$(call tc,objcopy) -R .text -R .data -R .bss \
|
||||
-R .comment -R .note -R .note.GNU-stack -R .reginfo \
|
||||
-R .gnu.attributes -R .MIPS.abiflags \
|
||||
-R .mdebug.eabi32 -R .gcc_compiled_long32 $1
|
||||
$(call tc,objcopy) --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main $1
|
||||
|
||||
#
|
||||
# Disassemble for human readability
|
||||
# objdump
|
||||
|
@ -1587,15 +1589,14 @@ tc.mips.r3000-linux.elf.gcc = mipsel-linux-gcc-4.1.1 -meb -march=r3000 -mno-abi
|
|||
tc.mips.r3000-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||
tc.mips.r3000-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror
|
||||
|
||||
mips.r3000-linux.elf-entry.h : $(srcdir)/src/mips.r3000-linux.elf-entry.lds \
|
||||
# No need for 'ld' because the only sections (ELFMAINX, ELFMAINZ) are both in elf-entry.S
|
||||
mips.r3000-linux.elf-entry.h : \
|
||||
$(srcdir)/src/$$T.S
|
||||
@echo; echo TARGET: $@; echo
|
||||
mipsel-linux-gcc-4.1.1 -E -D__mips__ -D__MIPSEB__ -D_TARGET_LINUX_ $(srcdir)/src/$T.S \
|
||||
| mipsel-elf-as-20060406 -EB -O -mno-pdr -o tmp/mips.r3000-linux.elf-entry.o
|
||||
mipsel-linux-gcc-4.1.1 -E -meb -march=r3000 -mno-abicalls -mabi=eabi -G0 -nostdinc -MMD \
|
||||
-D__mipsel__ -D__MIPS__ -D_TARGET_LINUX_ $(srcdir)/src/$T.S \
|
||||
| mips-elf-as-20060406 -EL -O -mno-pdr -o tmp/mips.r3000-linux.elf-entry.bin
|
||||
$(call tc,gpp_mkdep) --mode=c --MMD=$@ --MF=tmp/$T.d $(srcdir)/src/$T.S
|
||||
multiarch-ld-2.17 -r --format=elf32-bigmips -Map tmp/$T.map -o tmp/$T.bin \
|
||||
-T src/mips.r3000-linux.elf-entry.lds \
|
||||
tmp/mips.r3000-linux.elf-entry.o
|
||||
$(call tc,f-embed_objinfo_without_xstrip,tmp/$T.bin)
|
||||
$(call tc,bin2h) tmp/$T.bin $@
|
||||
|
||||
|
@ -1705,16 +1706,14 @@ tc.mipsel.r3000-linux.elf.gcc = mipsel-linux-gcc-4.1.1 -mel -D__MIPS__ -D__MIPS
|
|||
tc.mipsel.r3000-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||
tc.mipsel.r3000-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror
|
||||
|
||||
mipsel.r3000-linux.elf-entry.h : $(srcdir)/src/mipsel.r3000-linux.elf-entry.lds \
|
||||
# No need for 'ld' because the only sections (ELFMAINX, ELFMAINZ) are both in elf-entry.S
|
||||
mipsel.r3000-linux.elf-entry.h : \
|
||||
$(srcdir)/src/$$T.S
|
||||
@echo; echo TARGET: $@; echo
|
||||
mipsel-linux-gcc-4.1.1 -E -mel -march=r3000 -mno-abicalls -mabi=eabi -G0 -nostdinc -MMD \
|
||||
-D__mipsel__ -D__MIPSEL__ -D_TARGET_LINUX_ $(srcdir)/src/$T.S \
|
||||
| mipsel-elf-as-20060406 -EL -O -mno-pdr -o tmp/mipsel.r3000-linux.elf-entry.o
|
||||
| mipsel-elf-as-20060406 -EL -O -mno-pdr -o tmp/mipsel.r3000-linux.elf-entry.bin
|
||||
$(call tc,gpp_mkdep) --mode=c --MMD=$@ --MF=tmp/$T.d $(srcdir)/src/$T.S
|
||||
multiarch-ld-2.17 -r --format=elf32-littlemips -Map tmp/$T.map -o tmp/$T.bin \
|
||||
-T src/mipsel.r3000-linux.elf-entry.lds \
|
||||
tmp/mipsel.r3000-linux.elf-entry.o
|
||||
$(call tc,f-embed_objinfo_without_xstrip,tmp/$T.bin)
|
||||
$(call tc,bin2h) tmp/$T.bin $@
|
||||
|
||||
|
|
|
@ -271,6 +271,14 @@ f_expand:
|
|||
#define NO_METHOD_CHECK 1
|
||||
#include "arch/arm/v4a/nrv2b_d8.S"
|
||||
|
||||
// get_page_mask should never be called by _entry, because the 1st arg
|
||||
// (the pointer) to upx_mmap_and_fd is 0. But in the general case
|
||||
// there must be a get_page_mask subroutine. Return something plausible.
|
||||
get_page_mask: .globl get_page_mask
|
||||
mvn r0,#0
|
||||
mov r0,r0,lsl #12
|
||||
ret
|
||||
|
||||
.balign 4
|
||||
upx_mmap_and_fd: .globl upx_mmap_and_fd
|
||||
// section UMF_LINUX or UMF_ANDROID goes here
|
||||
|
|
|
@ -33,12 +33,19 @@
|
|||
#define DEBUG 0
|
||||
#endif //}
|
||||
|
||||
#define NO_WANT_MMAP 1
|
||||
#ifdef __mips__ //{
|
||||
// We want to supersede in *.elf-fold.S, not use include/linux.h
|
||||
#define NO_WANT_CLOSE 1
|
||||
#define NO_WANT_EXIT 1
|
||||
#define NO_WANT_MMAP 1
|
||||
#define NO_WANT_MPROTECT 1
|
||||
#define NO_WANT_MSYNC 1
|
||||
#define NO_WANT_OPEN 1
|
||||
#define NO_WANT_READ 1
|
||||
#define NO_WANT_WRITE 1
|
||||
extern int open(char const *pathname, int flags, unsigned mode);
|
||||
extern int read(int fd, void *buf, unsigned count);
|
||||
#endif //}
|
||||
#include "include/linux.h"
|
||||
|
||||
#define MFD_EXEC 0x0010
|
||||
|
|
|
@ -30,7 +30,7 @@ void my_bkpt(void const *, ...);
|
|||
#define ANDROID_FRIEND 0
|
||||
#define addr_string(string) ({ \
|
||||
char const *str; \
|
||||
asm("bal 0f; .asciz \"" string "\"; .balign 4\n0: move %0,$31" \
|
||||
asm(".set noreorder; bal 0f; nop; .asciz \"" string "\"; .balign 4\n0: move %0,$31; .set reorder" \
|
||||
/*out*/ : "=r"(str) \
|
||||
/* in*/ : \
|
||||
/*und*/ : "ra"); \
|
||||
|
@ -128,12 +128,17 @@ struct stat { // __NR_stat = 106 + NR_SYSCALL_BASE
|
|||
#define AT_FDCWD -100
|
||||
#define restrict /**/
|
||||
//
|
||||
#ifdef __mips__ //{
|
||||
// We want to supersede in *.elf-fold.S, not use include/linux.h
|
||||
#define NO_WANT_CLOSE 1
|
||||
#define NO_WANT_EXIT 1
|
||||
#define NO_WANT_MMAP 1
|
||||
#define NO_WANT_MPROTECT 1
|
||||
#define NO_WANT_MSYNC 1
|
||||
#define NO_WANT_OPEN 1
|
||||
#define NO_WANT_READ 1
|
||||
#define NO_WANT_WRITE 1
|
||||
#endif //}
|
||||
#include "include/linux.h" // syscalls; i386 inlines via "int 0x80"
|
||||
extern int open(char const *, int, int);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ extern void my_bkpt(void const *, ...);
|
|||
#define ANDROID_FRIEND 0
|
||||
#define addr_string(string) ({ \
|
||||
char const *str; \
|
||||
asm(".set noreorder; bal 0f; .asciz \"" string "\"; .balign 4\n0: move %0,$31; .set reorder" \
|
||||
asm(".set noreorder; bal 0f; nop; .asciz \"" string "\"; .balign 4\n0: move %0,$31; .set reorder" \
|
||||
/*out*/ : "=r"(str) \
|
||||
/* in*/ : \
|
||||
/*und*/ : "ra"); \
|
||||
|
@ -80,10 +80,15 @@ extern void my_bkpt(void const *, ...);
|
|||
#endif //}
|
||||
|
||||
#ifdef __mips__ //{
|
||||
#define NO_WANT_READ 1
|
||||
#define NO_WANT_CLOSE 1
|
||||
#define NO_WANT_EXIT 1
|
||||
#define NO_WANT_MMAP 1
|
||||
#define NO_WANT_MPROTECT 1
|
||||
#define NO_WANT_MSYNC 1
|
||||
#define NO_WANT_OPEN 1
|
||||
#define NO_WANT_READ 1
|
||||
#define NO_WANT_WRITE 1
|
||||
extern int open(char const *pathname, int flags, unsigned mode);
|
||||
#endif //}
|
||||
#include "include/linux.h" // syscall decls; i386 inlines via "int 0x80"
|
||||
|
||||
|
|
Loading…
Reference in New Issue