stash work-in-progress

modified:   linker.cpp
	modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   packmast.cpp
	modified:   stub/Makefile
	modified:   stub/src/amd64-darwin.macho-main.c
	modified:   stub/src/arm.v5a-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-fold.S
	modified:   stub/src/arm64-darwin.macho-main.c
This commit is contained in:
John Reiser
2017-12-19 17:32:15 -08:00
parent 576d9a4e7e
commit e8aa80f904
17 changed files with 1316 additions and 1420 deletions
+34 -34
View File
@@ -72,7 +72,7 @@ LOAD tmp/amd64-darwin.macho-main.o
.plt
*(.plt)
.text 0x0000000008048000 0x6e0
.text 0x0000000008048000 0xe32
*(.text .stub .text.* .gnu.linkonce.t.*)
.text 0x0000000008048000 0x157 tmp/amd64-darwin.macho-fold.o
0x00000000080480b8 munmap
@@ -87,17 +87,17 @@ LOAD tmp/amd64-darwin.macho-main.o
0x00000000080480b4 mprotect
0x00000000080480c0 close
*fill* 0x0000000008048157 0x1 90909090
.text 0x0000000008048158 0x588 tmp/amd64-darwin.macho-main.o
0x0000000008048294 do_xmap
0x0000000008048558 upx_main
.text 0x0000000008048158 0xcda tmp/amd64-darwin.macho-main.o
0x000000000804875f do_xmap
0x0000000008048be3 upx_main
*(.text.*personality*)
*(.gnu.warning)
.fini
*(.fini)
0x00000000080486e0 PROVIDE (__etext, .)
0x00000000080486e0 PROVIDE (_etext, .)
0x00000000080486e0 PROVIDE (etext, .)
0x0000000008048e32 PROVIDE (__etext, .)
0x0000000008048e32 PROVIDE (_etext, .)
0x0000000008048e32 PROVIDE (etext, .)
.rodata
*(.rodata .rodata.* .gnu.linkonce.r.*)
@@ -113,8 +113,8 @@ LOAD tmp/amd64-darwin.macho-main.o
.gcc_except_table
*(.gcc_except_table .gcc_except_table.*)
0x00000000080486e0 . = (ALIGN (0x1000) - ((0x1000 - .) & 0xfff))
0x00000000080496e0 . = (0x1000 DATA_SEGMENT_ALIGN 0x1000)
0x0000000008048e32 . = (ALIGN (0x1000) - ((0x1000 - .) & 0xfff))
0x0000000008049e32 . = (0x1000 DATA_SEGMENT_ALIGN 0x1000)
.eh_frame
*(.eh_frame)
@@ -129,22 +129,22 @@ LOAD tmp/amd64-darwin.macho-main.o
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
.preinit_array 0x00000000080496e0 0x0
0x00000000080496e0 PROVIDE (__preinit_array_start, .)
.preinit_array 0x0000000008049e32 0x0
0x0000000008049e32 PROVIDE (__preinit_array_start, .)
*(.preinit_array)
0x00000000080496e0 PROVIDE (__preinit_array_end, .)
0x0000000008049e32 PROVIDE (__preinit_array_end, .)
.init_array 0x00000000080496e0 0x0
0x00000000080496e0 PROVIDE (__init_array_start, .)
.init_array 0x0000000008049e32 0x0
0x0000000008049e32 PROVIDE (__init_array_start, .)
*(SORT(.init_array.*))
*(.init_array)
0x00000000080496e0 PROVIDE (__init_array_end, .)
0x0000000008049e32 PROVIDE (__init_array_end, .)
.fini_array 0x00000000080496e0 0x0
0x00000000080496e0 PROVIDE (__fini_array_start, .)
.fini_array 0x0000000008049e32 0x0
0x0000000008049e32 PROVIDE (__fini_array_start, .)
*(.fini_array)
*(SORT(.fini_array.*))
0x00000000080496e0 PROVIDE (__fini_array_end, .)
0x0000000008049e32 PROVIDE (__fini_array_end, .)
.ctors
*crtbegin*.o(.ctors)
@@ -170,35 +170,35 @@ LOAD tmp/amd64-darwin.macho-main.o
.got
*(.got)
0x00000000080496e0 . = (. DATA_SEGMENT_RELRO_END 0xc)
0x0000000008049e32 . = (. DATA_SEGMENT_RELRO_END 0xc)
.got.plt
*(.got.plt)
.data 0x00000000080496e0 0x0
.data 0x0000000008049e34 0x0
*(.data .data.* .gnu.linkonce.d.*)
.data 0x00000000080496e0 0x0 tmp/amd64-darwin.macho-fold.o
.data 0x00000000080496e0 0x0 tmp/amd64-darwin.macho-main.o
.data 0x0000000008049e34 0x0 tmp/amd64-darwin.macho-fold.o
.data 0x0000000008049e34 0x0 tmp/amd64-darwin.macho-main.o
*(.gnu.linkonce.d.*personality*)
.data1
*(.data1)
0x00000000080496e0 _edata = .
0x00000000080496e0 PROVIDE (edata, .)
0x00000000080496e0 __bss_start = .
0x0000000008049e34 _edata = .
0x0000000008049e34 PROVIDE (edata, .)
0x0000000008049e34 __bss_start = .
.bss 0x00000000080496e0 0x0
.bss 0x0000000008049e34 0x0
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
.bss 0x00000000080496e0 0x0 tmp/amd64-darwin.macho-fold.o
.bss 0x00000000080496e0 0x0 tmp/amd64-darwin.macho-main.o
.bss 0x0000000008049e34 0x0 tmp/amd64-darwin.macho-fold.o
.bss 0x0000000008049e34 0x0 tmp/amd64-darwin.macho-main.o
*(COMMON)
0x00000000080496e0 . = ALIGN ((. != 0x0)?0x4:0x1)
0x00000000080496e0 . = ALIGN (0x4)
0x00000000080496e0 . = ALIGN (0x4)
0x00000000080496e0 _end = .
0x00000000080496e0 PROVIDE (end, .)
0x00000000080496e0 . = DATA_SEGMENT_END (.)
0x0000000008049e34 . = ALIGN ((. != 0x0)?0x4:0x1)
0x0000000008049e34 . = ALIGN (0x4)
0x0000000008049e34 . = ALIGN (0x4)
0x0000000008049e34 _end = .
0x0000000008049e34 PROVIDE (end, .)
0x0000000008049e34 . = DATA_SEGMENT_END (.)
.stab
*(.stab)
+14 -14
View File
@@ -2,18 +2,18 @@ file format elf64-littleaarch64
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 MACHMAINX 00000044 0000000000000000 0000000000000000 00000040 2**0 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000000 0000000000000000 0000000000000000 00000084 2**0 CONTENTS, READONLY
2 NRV2E 00000128 0000000000000000 0000000000000000 00000084 2**0 CONTENTS, READONLY
3 NRV2D 0000011c 0000000000000000 0000000000000000 000001ac 2**0 CONTENTS, READONLY
4 NRV2B 000000f0 0000000000000000 0000000000000000 000002c8 2**0 CONTENTS, READONLY
5 NRV_TAIL 00000000 0000000000000000 0000000000000000 000003b8 2**0 CONTENTS, READONLY
6 LZMA_ELF00 000000d0 0000000000000000 0000000000000000 000003b8 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000968 0000000000000000 0000000000000000 00000488 2**0 CONTENTS, READONLY
8 LZMA_DEC10 0000049c 0000000000000000 0000000000000000 00000df0 2**0 CONTENTS, READONLY
9 LZMA_DEC30 00000000 0000000000000000 0000000000000000 0000128c 2**0 CONTENTS, READONLY
10 MACHMAINY 00000000 0000000000000000 0000000000000000 0000128c 2**0 CONTENTS, READONLY
11 MACHMAINZ 00000160 0000000000000000 0000000000000000 0000128c 2**0 CONTENTS, RELOC, READONLY
0 MACHMAINX 00000008 0000000000000000 0000000000000000 00000040 2**0 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000000 0000000000000000 0000000000000000 00000048 2**0 CONTENTS, READONLY
2 NRV2E 00000128 0000000000000000 0000000000000000 00000048 2**0 CONTENTS, READONLY
3 NRV2D 0000011c 0000000000000000 0000000000000000 00000170 2**0 CONTENTS, READONLY
4 NRV2B 000000f0 0000000000000000 0000000000000000 0000028c 2**0 CONTENTS, READONLY
5 NRV_TAIL 00000000 0000000000000000 0000000000000000 0000037c 2**0 CONTENTS, READONLY
6 LZMA_ELF00 000000d0 0000000000000000 0000000000000000 0000037c 2**0 CONTENTS, RELOC, READONLY
7 LZMA_DEC20 00000968 0000000000000000 0000000000000000 0000044c 2**0 CONTENTS, READONLY
8 LZMA_DEC10 0000049c 0000000000000000 0000000000000000 00000db4 2**0 CONTENTS, READONLY
9 LZMA_DEC30 00000000 0000000000000000 0000000000000000 00001250 2**0 CONTENTS, READONLY
10 MACHMAINY 00000000 0000000000000000 0000000000000000 00001250 2**0 CONTENTS, READONLY
11 MACHMAINZ 00000158 0000000000000000 0000000000000000 00001250 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
0000000000000000 l d LZMA_DEC30 0000000000000000 LZMA_DEC30
0000000000000000 l d MACHMAINZ 0000000000000000 MACHMAINZ
@@ -36,7 +36,7 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [MACHMAINX]:
OFFSET TYPE VALUE
0000000000000040 R_AARCH64_CALL26 MACHMAINZ+0x00000000000000e8
0000000000000004 R_AARCH64_CALL26 MACHMAINZ+0x00000000000000dc
RELOCATION RECORDS FOR [LZMA_ELF00]:
OFFSET TYPE VALUE
@@ -44,4 +44,4 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [MACHMAINZ]:
OFFSET TYPE VALUE
0000000000000138 R_AARCH64_ADR_PREL_LO21 _start-0x0000000000000008
0000000000000130 R_AARCH64_ADR_PREL_LO21 _start-0x0000000000000008
+59 -58
View File
@@ -67,35 +67,36 @@ LOAD tmp/arm64-darwin.macho-main.o
*(.iplt)
.iplt 0x0000000000400080 0x0 tmp/arm64-darwin.macho-fold.o
.text 0x0000000000400078 0x680
.text 0x0000000000400078 0xf6c
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
.text 0x0000000000400078 0x160 tmp/arm64-darwin.macho-fold.o
.text 0x0000000000400078 0x15c tmp/arm64-darwin.macho-fold.o
0x0000000000400078 _start
0x0000000000400134 spin
0x0000000000400138 exit
0x0000000000400140 read
0x000000000040014c write
0x0000000000400158 open
0x0000000000400164 close
0x0000000000400170 brk
0x000000000040017c munmap
0x0000000000400188 mprotect
0x0000000000400194 mmap
0x00000000004001a0 pread
0x00000000004001ac bswap
.text 0x00000000004001d8 0x520 tmp/arm64-darwin.macho-main.o
0x0000000000400550 upx_main
0x000000000040012c spin
0x0000000000400130 exit
0x0000000000400138 read
0x0000000000400144 write
0x0000000000400150 open
0x0000000000400160 close
0x000000000040016c brk
0x0000000000400178 munmap
0x0000000000400184 mprotect
0x0000000000400190 mmap
0x000000000040019c pread
0x00000000004001a8 bswap
.text 0x00000000004001d4 0xe10 tmp/arm64-darwin.macho-main.o
0x000000000040089c do_xmap
0x0000000000400d4c upx_main
*(.gnu.warning)
.fini
*(SORT(.fini))
0x00000000004006f8 PROVIDE (__etext, .)
0x00000000004006f8 PROVIDE (_etext, .)
0x00000000004006f8 PROVIDE (etext, .)
0x0000000000400fe4 PROVIDE (__etext, .)
0x0000000000400fe4 PROVIDE (_etext, .)
0x0000000000400fe4 PROVIDE (etext, .)
.rodata
*(.rodata .rodata.* .gnu.linkonce.r.*)
@@ -106,18 +107,18 @@ LOAD tmp/arm64-darwin.macho-main.o
.eh_frame_hdr
*(.eh_frame_hdr)
.eh_frame 0x00000000004006f8 0x100
.eh_frame 0x0000000000400fe8 0x1b8
*(.eh_frame)
.eh_frame 0x00000000004006f8 0x100 tmp/arm64-darwin.macho-main.o
0xf8 (size before relaxing)
.eh_frame 0x0000000000400fe8 0x1b8 tmp/arm64-darwin.macho-main.o
0x1a8 (size before relaxing)
.gcc_except_table
*(.gcc_except_table .gcc_except_table.*)
.exception_ranges
*(.exception_ranges .exception_ranges*)
0x00000000004007f8 . = (ALIGN (0x10000) - ((0x10000 - .) & 0xffff))
0x00000000004107f8 . = DATA_SEGMENT_ALIGN (0x10000, 0x1000)
0x00000000004011a0 . = (ALIGN (0x10000) - ((0x10000 - .) & 0xffff))
0x00000000004111a0 . = DATA_SEGMENT_ALIGN (0x10000, 0x1000)
.eh_frame
*(.eh_frame)
@@ -135,22 +136,22 @@ LOAD tmp/arm64-darwin.macho-main.o
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
.preinit_array 0x00000000004107f8 0x0
0x00000000004107f8 PROVIDE (__preinit_array_start, .)
.preinit_array 0x00000000004111a0 0x0
0x00000000004111a0 PROVIDE (__preinit_array_start, .)
*(.preinit_array)
0x00000000004107f8 PROVIDE (__preinit_array_end, .)
0x00000000004111a0 PROVIDE (__preinit_array_end, .)
.init_array 0x00000000004107f8 0x0
0x00000000004107f8 PROVIDE (__init_array_start, .)
.init_array 0x00000000004111a0 0x0
0x00000000004111a0 PROVIDE (__init_array_start, .)
*(SORT(.init_array.*))
*(.init_array)
0x00000000004107f8 PROVIDE (__init_array_end, .)
0x00000000004111a0 PROVIDE (__init_array_end, .)
.fini_array 0x00000000004107f8 0x0
0x00000000004107f8 PROVIDE (__fini_array_start, .)
.fini_array 0x00000000004111a0 0x0
0x00000000004111a0 PROVIDE (__fini_array_start, .)
*(SORT(.fini_array.*))
*(.fini_array)
0x00000000004107f8 PROVIDE (__fini_array_end, .)
0x00000000004111a0 PROVIDE (__fini_array_end, .)
.ctors
*crtbegin.o(.ctors)
@@ -179,43 +180,43 @@ LOAD tmp/arm64-darwin.macho-main.o
.got
*(.got)
*(.igot)
0x00000000004107f8 . = DATA_SEGMENT_RELRO_END (., 0x18)
0x00000000004111a0 . = DATA_SEGMENT_RELRO_END (., 0x18)
.got.plt 0x00000000004107f8 0x0
.got.plt 0x00000000004111a0 0x0
*(.got.plt)
*(.igot.plt)
.igot.plt 0x00000000004107f8 0x0 tmp/arm64-darwin.macho-fold.o
.igot.plt 0x00000000004111a0 0x0 tmp/arm64-darwin.macho-fold.o
.data 0x00000000004107f8 0x0
0x00000000004107f8 PROVIDE (__data_start, .)
.data 0x00000000004111a0 0x0
0x00000000004111a0 PROVIDE (__data_start, .)
*(.data .data.* .gnu.linkonce.d.*)
.data 0x00000000004107f8 0x0 tmp/arm64-darwin.macho-fold.o
.data 0x00000000004107f8 0x0 tmp/arm64-darwin.macho-main.o
.data 0x00000000004111a0 0x0 tmp/arm64-darwin.macho-fold.o
.data 0x00000000004111a0 0x0 tmp/arm64-darwin.macho-main.o
.data1
*(.data1)
0x00000000004107f8 _edata = .
0x00000000004107f8 PROVIDE (edata, .)
0x00000000004107f8 . = .
0x00000000004107f8 __bss_start = .
0x00000000004107f8 __bss_start__ = .
0x00000000004111a0 _edata = .
0x00000000004111a0 PROVIDE (edata, .)
0x00000000004111a0 . = .
0x00000000004111a0 __bss_start = .
0x00000000004111a0 __bss_start__ = .
.bss 0x00000000004107f8 0x0
.bss 0x00000000004111a0 0x0
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
.bss 0x00000000004107f8 0x0 tmp/arm64-darwin.macho-fold.o
.bss 0x00000000004107f8 0x0 tmp/arm64-darwin.macho-main.o
.bss 0x00000000004111a0 0x0 tmp/arm64-darwin.macho-fold.o
.bss 0x00000000004111a0 0x0 tmp/arm64-darwin.macho-main.o
*(COMMON)
0x00000000004107f8 . = ALIGN ((. != 0x0)?0x8:0x1)
0x00000000004107f8 _bss_end__ = .
0x00000000004107f8 __bss_end__ = .
0x00000000004107f8 . = ALIGN (0x8)
0x00000000004107f8 . = SEGMENT_START ("ldata-segment", .)
0x00000000004107f8 . = ALIGN (0x8)
0x00000000004107f8 __end__ = .
0x00000000004107f8 _end = .
0x00000000004107f8 PROVIDE (end, .)
0x00000000004107f8 . = DATA_SEGMENT_END (.)
0x00000000004111a0 . = ALIGN ((. != 0x0)?0x8:0x1)
0x00000000004111a0 _bss_end__ = .
0x00000000004111a0 __bss_end__ = .
0x00000000004111a0 . = ALIGN (0x8)
0x00000000004111a0 . = SEGMENT_START ("ldata-segment", .)
0x00000000004111a0 . = ALIGN (0x8)
0x00000000004111a0 __end__ = .
0x00000000004111a0 _end = .
0x00000000004111a0 PROVIDE (end, .)
0x00000000004111a0 . = DATA_SEGMENT_END (.)
.stab
*(.stab)