ELF2 for powerpc (32-bit) main programs

modified:   ../misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
	modified:   p_lx_elf.cpp
	modified:   stub/Makefile
	modified:   stub/src/arch/powerpc/32/macros.S
	modified:   stub/src/i386-linux.elf-main2.c
	new file:   stub/src/powerpc-expand.S
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-fold.lds
	new file:   stub/src/powerpc-linux.elf-main2.c
	modified:   stub/src/powerpc64-linux.elf-fold.S
           plus generated *.h *.map *.dump

 interactive rebase in progress; onto ac82d473
 Last commands done (17 commands done):
    pick 1b9ddea5 ELF2 arm32-linux unmap_all_pages
    pick 1f372e54 ELF2 for powerpc (32-bit) main programs
 Next commands to do (10 remaining commands):
    pick 5f5849a9 ELF2 stragglers from stub make
    pick 2ba8b5da ELF2 for mips 32-bit main programs
 You are currently rebasing branch 'jreiser-ELF2' on 'ac82d473'.

 Changes to be committed:
	modified:   misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
	modified:   src/p_lx_elf.cpp
	modified:   src/stub/Makefile
	modified:   src/stub/powerpc-linux.elf-entry.h
	modified:   src/stub/powerpc-linux.elf-fold.h
	modified:   src/stub/powerpc64-linux.elf-fold.h
	modified:   src/stub/powerpc64le-linux.elf-fold.h
	modified:   src/stub/src/arch/powerpc/32/macros.S
	modified:   src/stub/src/i386-linux.elf-main2.c
	new file:   src/stub/src/powerpc-expand.S
	modified:   src/stub/src/powerpc-linux.elf-entry.S
	modified:   src/stub/src/powerpc-linux.elf-fold.S
	modified:   src/stub/src/powerpc-linux.elf-fold.lds
	new file:   src/stub/src/powerpc-linux.elf-main2.c
	modified:   src/stub/src/powerpc64-linux.elf-fold.S
	modified:   src/stub/tmp/powerpc-linux.elf-entry.bin.dump
	modified:   src/stub/tmp/powerpc-linux.elf-fold.map
	modified:   src/stub/tmp/powerpc64-linux.elf-fold.map
	modified:   src/stub/tmp/powerpc64le-linux.elf-fold.map
This commit is contained in:
John Reiser
2024-07-09 11:06:49 -07:00
parent 6cda0b6016
commit 88c94d1cc0
19 changed files with 3894 additions and 3010 deletions
+7 -46
View File
@@ -2,60 +2,21 @@ file format elf32-powerpc
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 04 0 0 034 2**0 CONTENTS
1 NRV_HEAD 0 0 0 038 2**0 CONTENTS
2 NRV2E 014c 0 0 038 2**0 CONTENTS
3 NRV2D 0130 0 0 0184 2**0 CONTENTS
4 NRV2B 0f4 0 0 02b4 2**0 CONTENTS
5 LZMA_ELF00 090 0 0 03a8 2**0 CONTENTS
6 LZMA_DEC10 099c 0 0 0438 2**0 CONTENTS
7 LZMA_DEC20 099c 0 0 0dd4 2**0 CONTENTS
8 LZMA_DEC30 024 0 0 01770 2**0 CONTENTS
9 NRV_TAIL 01c 0 0 01794 2**0 CONTENTS
10 CFLUSH 024 0 0 017b0 2**0 CONTENTS
11 ELFMAINY 012 0 0 017d4 2**0 CONTENTS
12 ELFMAINZ 011c 0 0 017e6 2**0 CONTENTS
0 ELFMAINX 0138 0 0 034 2**0 CONTENTS
1 ELFMAINY 0 0 0 016c 2**0 CONTENTS
2 ELFMAINZ 0154 0 0 016c 2**0 CONTENTS
SYMBOL TABLE:
00000000 l d LZMA_DEC30 0 LZMA_DEC30
00000000 l d NRV_TAIL 0 NRV_TAIL
00000000 l d ELFMAINZ 0 ELFMAINZ
00000000 l d ELFMAINX 0 ELFMAINX
00000000 l d NRV_HEAD 0 NRV_HEAD
00000000 l d NRV2E 0 NRV2E
00000000 l d NRV2D 0 NRV2D
00000000 l d NRV2B 0 NRV2B
00000000 l d LZMA_ELF00 0 LZMA_ELF00
00000000 l d LZMA_DEC10 0 LZMA_DEC10
00000000 l d LZMA_DEC20 0 LZMA_DEC20
00000000 l d CFLUSH 0 CFLUSH
00000000 l d ELFMAINZ 0 ELFMAINZ
00000000 l d ELFMAINY 0 ELFMAINY
00000000 g ELFMAINX 0 _start
00000000 *UND* 0 O_BINFO
RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE
00000000 R_PPC_REL24 ELFMAINZ+0x000000d4
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
000000b8 R_PPC_REL14 NRV_TAIL
RELOCATION RECORDS FOR [NRV2D]:
OFFSET TYPE VALUE
000000b8 R_PPC_REL14 NRV_TAIL
RELOCATION RECORDS FOR [NRV2B]:
OFFSET TYPE VALUE
00000094 R_PPC_REL14 NRV_TAIL
RELOCATION RECORDS FOR [LZMA_ELF00]:
OFFSET TYPE VALUE
00000004 R_PPC_REL14 LZMA_DEC30+0x00000024
RELOCATION RECORDS FOR [ELFMAINY]:
OFFSET TYPE VALUE
00000000 R_PPC_REL24 ELFMAINZ
00000000 R_PPC_REL24 ELFMAINZ+0x0000010c
RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE
00000118 R_PPC_ADDR32 O_BINFO
00000064 R_PPC_REL24 ELFMAINX+0x00000004
00000150 R_PPC_ADDR32 O_BINFO
+74 -27
View File
@@ -7,38 +7,85 @@ Name Origin Length Attributes
Linker script and memory map
TARGET(elf32-powerpc)
0x0000000000100080 . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x0000000000100080 0x1164
.text 0x0000000000000000 0x2248
*(.text)
.text 0x0000000000100080 0x318 tmp/powerpc-linux.elf-fold.o
0x000000000010008c get_page_mask
0x0000000000100388 munmap
0x0000000000100360 readlink
0x000000000010033c mmap
0x0000000000100368 write
0x0000000000100370 read
0x0000000000100390 my_bkpt
0x00000000001000a4 Pprotect
0x0000000000100350 exit
0x0000000000100358 brk
0x0000000000100378 open
0x00000000001000a4 mprotect
0x0000000000100380 close
.text 0x0000000000100398 0xe4c tmp/powerpc-linux.elf-main.o
0x0000000000100fe4 upx_main
.text 0x0000000000000000 0x258 tmp/powerpc-linux.elf-fold.o
0x000000000000000c get_page_mask
0x0000000000000024 Pprotect
0x0000000000000024 mprotect
.text 0x0000000000000258 0xb8 tmp/powerpc-linux.elf-upxfd_android.o
0x0000000000000258 upx_mmap_and_fd
.text 0x0000000000000310 0x0 tmp/powerpc-expand.o
.text 0x0000000000000310 0x1f38 tmp/powerpc-linux.elf-main2.o
0x0000000000000af0 underlay
0x0000000000001804 upx_main
*(.data)
.data 0x00000000001011e4 0x0 tmp/powerpc-linux.elf-fold.o
.data 0x00000000001011e4 0x0 tmp/powerpc-linux.elf-main.o
.data 0x0000000000002248 0x0 tmp/powerpc-linux.elf-fold.o
.data 0x0000000000002248 0x0 tmp/powerpc-linux.elf-upxfd_android.o
.data 0x0000000000002248 0x0 tmp/powerpc-expand.o
.data 0x0000000000002248 0x0 tmp/powerpc-linux.elf-main2.o
.data
.bss 0x00000000001011e4 0x0
.bss 0x00000000001011e4 0x0 tmp/powerpc-linux.elf-fold.o
.bss 0x00000000001011e4 0x0 tmp/powerpc-linux.elf-main.o
.rela.dyn 0x00000000001011e4 0x0
.rela.text 0x0000000000000000 0x0 tmp/powerpc-linux.elf-fold.o
.bss 0x0000000000000000 0x0
.bss 0x0000000000000000 0x0 tmp/powerpc-linux.elf-fold.o
.bss 0x0000000000000000 0x0 tmp/powerpc-linux.elf-upxfd_android.o
.bss 0x0000000000000000 0x0 tmp/powerpc-expand.o
.bss 0x0000000000000000 0x0 tmp/powerpc-linux.elf-main2.o
LOAD tmp/powerpc-linux.elf-fold.o
LOAD tmp/powerpc-linux.elf-main.o
LOAD tmp/powerpc-linux.elf-upxfd_android.o
LOAD tmp/powerpc-expand.o
LOAD tmp/powerpc-linux.elf-main2.o
OUTPUT(tmp/powerpc-linux.elf-fold.bin elf32-powerpc)
SYSCALLS 0x0000000000000000 0xac
SYSCALLS 0x0000000000000000 0xac tmp/powerpc-linux.elf-fold.o
0x000000000000005c munmap
0x0000000000000064 memcpy
0x0000000000000034 readlink
0x000000000000001c ftruncate
0x0000000000000000 mmap
0x000000000000003c write
0x0000000000000014 memfd_create
0x0000000000000044 read
0x0000000000000088 memset
0x00000000000000a4 my_bkpt
0x0000000000000024 exit
0x000000000000002c brk
0x000000000000004c open
0x0000000000000054 close
.note.GNU-stack
0x0000000000000000 0x0
.note.GNU-stack
0x0000000000000000 0x0 tmp/powerpc-linux.elf-upxfd_android.o
EXP_HEAD 0x0000000000000000 0xa8
EXP_HEAD 0x0000000000000000 0xa8 tmp/powerpc-expand.o
0x0000000000000000 f_expand
EXP_TAIL 0x0000000000000000 0x84
EXP_TAIL 0x0000000000000000 0x84 tmp/powerpc-expand.o
0x0000000000000000 eof_nrv
NRV2E 0x0000000000000000 0x14c
NRV2E 0x0000000000000000 0x14c tmp/powerpc-expand.o
NRV2D 0x0000000000000000 0x130
NRV2D 0x0000000000000000 0x130 tmp/powerpc-expand.o
NRV2B 0x0000000000000000 0xf4
NRV2B 0x0000000000000000 0xf4 tmp/powerpc-expand.o
LZMA_ELF00 0x0000000000000000 0x90
LZMA_ELF00 0x0000000000000000 0x90 tmp/powerpc-expand.o
LZMA_DEC10 0x0000000000000000 0x99c
LZMA_DEC10 0x0000000000000000 0x99c tmp/powerpc-expand.o
LZMA_DEC20 0x0000000000000000 0x99c
LZMA_DEC20 0x0000000000000000 0x99c tmp/powerpc-expand.o
LZMA_DEC30 0x0000000000000000 0x24
LZMA_DEC30 0x0000000000000000 0x24 tmp/powerpc-expand.o
+3 -3
View File
@@ -27,8 +27,8 @@ OUTPUT(tmp/powerpc64-linux.elf-fold.bin elf64-powerpc)
.bss 0x0000000000000000 0x0
.bss 0x0000000000000000 0x0 tmp/powerpc64-linux.elf-fold.o
SYSCALLS 0x0000000000000000 0xf4
SYSCALLS 0x0000000000000000 0xf4 tmp/powerpc64-linux.elf-fold.o
SYSCALLS 0x0000000000000000 0xfc
SYSCALLS 0x0000000000000000 0xfc tmp/powerpc64-linux.elf-fold.o
0x0000000000000008 mmap
0x0000000000000020 munmap
0x0000000000000028 mprotect
@@ -43,7 +43,7 @@ SYSCALLS 0x0000000000000000 0xf4
0x0000000000000070 close
0x0000000000000078 upxfd_create
0x00000000000000d0 memcpy
0x00000000000000ec my_bkpt
0x00000000000000f4 my_bkpt
.comment 0x0000000000000000 0x33
.comment 0x0000000000000000 0x33 tmp/powerpc64-linux.elf-fold.o
+3 -3
View File
@@ -27,8 +27,8 @@ OUTPUT(tmp/powerpc64le-linux.elf-fold.bin elf64-powerpcle)
.bss 0x0000000000000000 0x0
.bss 0x0000000000000000 0x0 tmp/powerpc64le-linux.elf-fold.o
SYSCALLS 0x0000000000000000 0xf4
SYSCALLS 0x0000000000000000 0xf4 tmp/powerpc64le-linux.elf-fold.o
SYSCALLS 0x0000000000000000 0xfc
SYSCALLS 0x0000000000000000 0xfc tmp/powerpc64le-linux.elf-fold.o
0x0000000000000008 mmap
0x0000000000000020 munmap
0x0000000000000028 mprotect
@@ -43,7 +43,7 @@ SYSCALLS 0x0000000000000000 0xf4
0x0000000000000070 close
0x0000000000000078 upxfd_create
0x00000000000000d0 memcpy
0x00000000000000ec my_bkpt
0x00000000000000f4 my_bkpt
.comment 0x0000000000000000 0x33
.comment 0x0000000000000000 0x33 tmp/powerpc64le-linux.elf-fold.o