ELF2 for PowerPC64

(MacOS temporarily disabled)
	modified:   ../misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
	modified:   p_lx_elf.cpp
	modified:   stub/Makefile
	modified:   stub/src/arch/powerpc/64/macros.S
	modified:   stub/src/arch/powerpc/64le/bxx.S
	modified:   stub/src/arch/powerpc/64le/macros.S
	modified:   stub/src/arch/powerpc/64le/ppc_regs.h
	new file:   stub/src/dollar-dollar.sed
	modified:   stub/src/powerpc64-linux.elf-entry.S
	modified:   stub/src/powerpc64-linux.elf-fold.S
	modified:   stub/src/powerpc64-linux.elf-fold.lds
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-fold.lds
	modified:   stub/src/powerpc64le-linux.kernel.vmlinux.S
           plus generated *.h *.map *.dump
This commit is contained in:
John Reiser
2024-06-29 19:50:59 -07:00
parent 35fca2062e
commit 146c105961
23 changed files with 3731 additions and 2737 deletions
+6 -42
View File
@@ -2,33 +2,13 @@ file format elf64-powerpc
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 04 0 0 040 2**0 CONTENTS
1 NRV_HEAD 0 0 0 044 2**0 CONTENTS
2 NRV2E 0154 0 0 044 2**0 CONTENTS
3 NRV2D 013c 0 0 0198 2**0 CONTENTS
4 NRV2B 0f8 0 0 02d4 2**0 CONTENTS
5 LZMA_ELF00 094 0 0 03cc 2**0 CONTENTS
6 LZMA_DEC30 028 0 0 0460 2**0 CONTENTS
7 LZMA_DEC10 0bc0 0 0 0488 2**0 CONTENTS
8 LZMA_DEC20 0c74 0 0 01048 2**0 CONTENTS
9 NRV_TAIL 01c 0 0 01cbc 2**0 CONTENTS
10 CFLUSH 024 0 0 01cd8 2**0 CONTENTS
11 ELFMAINY 012 0 0 01cfc 2**0 CONTENTS
12 ELFMAINZe 018 0 0 01d10 2**3 CONTENTS
13 ELFMAINZ 0190 0 0 01d28 2**2 CONTENTS
0 ELFMAINX 013c 0 0 040 2**0 CONTENTS
1 ELFMAINY 012 0 0 017c 2**0 CONTENTS
2 ELFMAINZe 018 0 0 0190 2**3 CONTENTS
3 ELFMAINZ 01d4 0 0 01a8 2**2 CONTENTS
SYMBOL TABLE:
0000000000000000 l d LZMA_DEC30 0 LZMA_DEC30
0000000000000000 l d NRV_TAIL 0 NRV_TAIL
0000000000000000 l d ELFMAINZ 0 ELFMAINZ
0000000000000000 l d ELFMAINX 0 ELFMAINX
0000000000000000 l d NRV_HEAD 0 NRV_HEAD
0000000000000000 l d NRV2E 0 NRV2E
0000000000000000 l d NRV2D 0 NRV2D
0000000000000000 l d NRV2B 0 NRV2B
0000000000000000 l d LZMA_ELF00 0 LZMA_ELF00
0000000000000000 l d LZMA_DEC10 0 LZMA_DEC10
0000000000000000 l d LZMA_DEC20 0 LZMA_DEC20
0000000000000000 l d CFLUSH 0 CFLUSH
0000000000000000 l d ELFMAINY 0 ELFMAINY
0000000000000000 l d ELFMAINZe 0 ELFMAINZe
0000000000000000 g ELFMAINX 0 _start
@@ -37,23 +17,7 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE
0000000000000000 R_PPC64_REL24 ELFMAINZ+0x00000000000000d4
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
00000000000000c0 R_PPC64_REL14 NRV_TAIL
RELOCATION RECORDS FOR [NRV2D]:
OFFSET TYPE VALUE
00000000000000c4 R_PPC64_REL14 NRV_TAIL
RELOCATION RECORDS FOR [NRV2B]:
OFFSET TYPE VALUE
0000000000000098 R_PPC64_REL14 NRV_TAIL
RELOCATION RECORDS FOR [LZMA_ELF00]:
OFFSET TYPE VALUE
0000000000000004 R_PPC64_REL14 LZMA_DEC30+0x0000000000000028
0000000000000000 R_PPC64_REL24 ELFMAINZ+0x0000000000000118
RELOCATION RECORDS FOR [ELFMAINY]:
OFFSET TYPE VALUE
@@ -65,4 +29,4 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE
000000000000018c R_PPC64_ADDR32 O_BINFO
00000000000001d0 R_PPC64_ADDR32 O_BINFO
+62 -50
View File
@@ -7,65 +7,77 @@ Name Origin Length Attributes
Linker script and memory map
TARGET(elf64-powerpc)
0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x00000000001000bc 0xc84
.text 0x0000000000000000 0xd6c
*(.text)
.text 0x00000000001000bc 0x38c tmp/powerpc64-linux.elf-fold.o
0x00000000001000cc get_page_mask
0x00000000001000e4 Pprotect
0x00000000001000e4 mprotect
0x00000000001003e8 mmap
0x0000000000100400 exit
0x0000000000100408 brk
0x0000000000100410 readlink
0x0000000000100418 write
0x0000000000100420 read
0x0000000000100428 open
0x0000000000100430 close
0x0000000000100438 munmap
0x0000000000100440 my_bkpt
.text 0x0000000000100448 0x8f8 tmp/powerpc64-linux.elf-main.o
.text 0x0000000000000000 0xd6c tmp/powerpc64-linux.elf-fold.o
0x0000000000000014 get_page_mask
0x0000000000000b48 underlay
0x0000000000000bd4 upx_main
*(.data)
.data 0x0000000000100d40 0x0 tmp/powerpc64-linux.elf-fold.o
.data 0x0000000000100d40 0x0 tmp/powerpc64-linux.elf-main.o
.sfpr 0x0000000000100d40 0xa4
.sfpr 0x0000000000100d40 0xa4 linker stubs
0x0000000000100d40 _savegpr0_14
0x0000000000100d68 _savegpr0_24
0x0000000000100d78 _savegpr0_28
0x0000000000100d90 _restgpr0_14
0x0000000000100db8 _restgpr0_24
0x0000000000100dc8 _restgpr0_28
.glink 0x0000000000100de8 0x0
.glink 0x0000000000100de8 0x0 linker stubs
.eh_frame 0x0000000000100de4 0x0
.eh_frame 0x0000000000100de4 0x0 linker stubs
.rela.dyn 0x0000000000100de8 0x0
.rela.iplt 0x0000000000100de8 0x0 linker stubs
.data 0x0000000000000d6c 0x0 tmp/powerpc64-linux.elf-fold.o
.data
LOAD tmp/powerpc64-linux.elf-fold.o
LOAD tmp/powerpc64-linux.elf-main.o
OUTPUT(tmp/powerpc64-linux.elf-fold.bin elf64-powerpc)
.branch_lt 0x0000000000100de8 0x0
.branch_lt 0x0000000000100de8 0x0 linker stubs
.bss 0x0000000000000000 0x0
.bss 0x0000000000000000 0x0 tmp/powerpc64-linux.elf-fold.o
.toc 0x0000000000100de8 0x0
.toc 0x0000000000100de8 0x0 tmp/powerpc64-linux.elf-main.o
SYSCALLS 0x0000000000000000 0x11c
SYSCALLS 0x0000000000000000 0x11c tmp/powerpc64-linux.elf-fold.o
0x0000000000000000 Pmap
0x0000000000000010 mmap
0x0000000000000028 Pprotect
0x0000000000000028 mprotect
0x0000000000000040 Punmap
0x0000000000000050 munmap
0x0000000000000058 memfd_create
0x0000000000000060 ftruncate
0x0000000000000068 exit
0x0000000000000070 brk
0x0000000000000078 readlink
0x0000000000000080 write
0x0000000000000088 read
0x0000000000000090 open
0x0000000000000098 close
0x00000000000000a0 upxfd_create
0x00000000000000f8 memcpy
0x0000000000000114 my_bkpt
.opd 0x0000000000100de8 0x58
.opd 0x0000000000100de8 0x58 tmp/powerpc64-linux.elf-main.o
0x0000000000100e28 upx_main
.comment 0x0000000000000000 0x33
.comment 0x0000000000000000 0x33 tmp/powerpc64-linux.elf-fold.o
.iplt 0x0000000000100e40 0x0
.iplt 0x0000000000100e40 0x0 linker stubs
.note.GNU-stack
0x0000000000000000 0x0
.note.GNU-stack
0x0000000000000000 0x0 tmp/powerpc64-linux.elf-fold.o
.bss 0x0000000000100e40 0x0
.bss 0x0000000000100e40 0x0 tmp/powerpc64-linux.elf-fold.o
.bss 0x0000000000100e40 0x0 tmp/powerpc64-linux.elf-main.o
EXP_HEAD 0x0000000000000000 0xa8
EXP_HEAD 0x0000000000000000 0xa8 tmp/powerpc64-linux.elf-fold.o
0x0000000000000000 f_expand
EXP_TAIL 0x0000000000000000 0x84
EXP_TAIL 0x0000000000000000 0x84 tmp/powerpc64-linux.elf-fold.o
0x0000000000000000 eof_nrv
NRV2E 0x0000000000000000 0x154
NRV2E 0x0000000000000000 0x154 tmp/powerpc64-linux.elf-fold.o
NRV2D 0x0000000000000000 0x13c
NRV2D 0x0000000000000000 0x13c tmp/powerpc64-linux.elf-fold.o
NRV2B 0x0000000000000000 0xf8
NRV2B 0x0000000000000000 0xf8 tmp/powerpc64-linux.elf-fold.o
LZMA_ELF00 0x0000000000000000 0x94
LZMA_ELF00 0x0000000000000000 0x94 tmp/powerpc64-linux.elf-fold.o
LZMA_DEC30 0x0000000000000000 0x28
LZMA_DEC30 0x0000000000000000 0x28 tmp/powerpc64-linux.elf-fold.o
LZMA_DEC10 0x0000000000000000 0xbc0
LZMA_DEC10 0x0000000000000000 0xbc0 tmp/powerpc64-linux.elf-fold.o
LZMA_DEC20 0x0000000000000000 0xc74
LZMA_DEC20 0x0000000000000000 0xc74 tmp/powerpc64-linux.elf-fold.o
+5 -41
View File
@@ -2,55 +2,19 @@ file format elf64-powerpcle
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 04 0 0 040 2**0 CONTENTS
1 NRV_HEAD 0 0 0 044 2**0 CONTENTS
2 NRV2E 0154 0 0 044 2**0 CONTENTS
3 NRV2D 013c 0 0 0198 2**0 CONTENTS
4 NRV2B 0f8 0 0 02d4 2**0 CONTENTS
5 LZMA_ELF00 094 0 0 03cc 2**0 CONTENTS
6 LZMA_DEC30 028 0 0 0460 2**0 CONTENTS
7 LZMA_DEC10 0bb8 0 0 0488 2**0 CONTENTS
8 LZMA_DEC20 0c74 0 0 01040 2**0 CONTENTS
9 NRV_TAIL 01c 0 0 01cb4 2**0 CONTENTS
10 CFLUSH 024 0 0 01cd0 2**0 CONTENTS
11 ELFMAINY 012 0 0 01cf4 2**0 CONTENTS
12 ELFMAINZ 0190 0 0 01d08 2**2 CONTENTS
0 ELFMAINX 013c 0 0 040 2**0 CONTENTS
1 ELFMAINY 012 0 0 017c 2**0 CONTENTS
2 ELFMAINZ 01d4 0 0 0190 2**2 CONTENTS
SYMBOL TABLE:
0000000000000000 l d LZMA_DEC30 0 LZMA_DEC30
0000000000000000 l d NRV_TAIL 0 NRV_TAIL
0000000000000000 l d ELFMAINZ 0 ELFMAINZ
0000000000000000 l d ELFMAINX 0 ELFMAINX
0000000000000000 l d NRV_HEAD 0 NRV_HEAD
0000000000000000 l d NRV2E 0 NRV2E
0000000000000000 l d NRV2D 0 NRV2D
0000000000000000 l d NRV2B 0 NRV2B
0000000000000000 l d LZMA_ELF00 0 LZMA_ELF00
0000000000000000 l d LZMA_DEC10 0 LZMA_DEC10
0000000000000000 l d LZMA_DEC20 0 LZMA_DEC20
0000000000000000 l d CFLUSH 0 CFLUSH
0000000000000000 l d ELFMAINY 0 ELFMAINY
0000000000000000 g ELFMAINX 0 _start
0000000000000000 *UND* 0 O_BINFO
RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE
0000000000000000 R_PPC64_REL24 ELFMAINZ+0x00000000000000d4
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
00000000000000c0 R_PPC64_REL14 NRV_TAIL
RELOCATION RECORDS FOR [NRV2D]:
OFFSET TYPE VALUE
00000000000000c4 R_PPC64_REL14 NRV_TAIL
RELOCATION RECORDS FOR [NRV2B]:
OFFSET TYPE VALUE
0000000000000098 R_PPC64_REL14 NRV_TAIL
RELOCATION RECORDS FOR [LZMA_ELF00]:
OFFSET TYPE VALUE
0000000000000004 R_PPC64_REL14 LZMA_DEC30+0x0000000000000028
0000000000000000 R_PPC64_REL24 ELFMAINZ+0x0000000000000118
RELOCATION RECORDS FOR [ELFMAINY]:
OFFSET TYPE VALUE
@@ -58,4 +22,4 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE
000000000000018c R_PPC64_ADDR32 O_BINFO
00000000000001d0 R_PPC64_ADDR32 O_BINFO
+62 -50
View File
@@ -7,65 +7,77 @@ Name Origin Length Attributes
Linker script and memory map
TARGET(elf64-powerpcle)
0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x00000000001000bc 0xc80
.text 0x0000000000000000 0xd94
*(.text)
.text 0x00000000001000bc 0x38c tmp/powerpc64le-linux.elf-fold.o
0x00000000001000cc get_page_mask
0x00000000001000e4 Pprotect
0x00000000001000e4 mprotect
0x00000000001003e8 mmap
0x0000000000100400 exit
0x0000000000100408 brk
0x0000000000100410 readlink
0x0000000000100418 write
0x0000000000100420 read
0x0000000000100428 open
0x0000000000100430 close
0x0000000000100438 munmap
0x0000000000100440 my_bkpt
.text 0x0000000000100448 0x8f4 tmp/powerpc64le-linux.elf-main.o
.text 0x0000000000000000 0xd94 tmp/powerpc64le-linux.elf-fold.o
0x0000000000000014 get_page_mask
0x0000000000000b70 underlay
0x0000000000000bfc upx_main
*(.data)
.data 0x0000000000100d3c 0x0 tmp/powerpc64le-linux.elf-fold.o
.data 0x0000000000100d3c 0x0 tmp/powerpc64le-linux.elf-main.o
.sfpr 0x0000000000100d3c 0xa4
.sfpr 0x0000000000100d3c 0xa4 linker stubs
0x0000000000100d3c _savegpr0_14
0x0000000000100d64 _savegpr0_24
0x0000000000100d74 _savegpr0_28
0x0000000000100d8c _restgpr0_14
0x0000000000100db4 _restgpr0_24
0x0000000000100dc4 _restgpr0_28
.glink 0x0000000000100de0 0x0
.glink 0x0000000000100de0 0x0 linker stubs
.eh_frame 0x0000000000100de0 0x0
.eh_frame 0x0000000000100de0 0x0 linker stubs
.rela.dyn 0x0000000000100de0 0x0
.rela.iplt 0x0000000000100de0 0x0 linker stubs
.data 0x0000000000000d94 0x0 tmp/powerpc64le-linux.elf-fold.o
.data
LOAD tmp/powerpc64le-linux.elf-fold.o
LOAD tmp/powerpc64le-linux.elf-main.o
OUTPUT(tmp/powerpc64le-linux.elf-fold.bin elf64-powerpcle)
.branch_lt 0x0000000000100de0 0x0
.branch_lt 0x0000000000100de0 0x0 linker stubs
.bss 0x0000000000000000 0x0
.bss 0x0000000000000000 0x0 tmp/powerpc64le-linux.elf-fold.o
.toc 0x0000000000100de0 0x0
.toc 0x0000000000100de0 0x0 tmp/powerpc64le-linux.elf-main.o
SYSCALLS 0x0000000000000000 0x11c
SYSCALLS 0x0000000000000000 0x11c tmp/powerpc64le-linux.elf-fold.o
0x0000000000000000 Pmap
0x0000000000000010 mmap
0x0000000000000028 Pprotect
0x0000000000000028 mprotect
0x0000000000000040 Punmap
0x0000000000000050 munmap
0x0000000000000058 memfd_create
0x0000000000000060 ftruncate
0x0000000000000068 exit
0x0000000000000070 brk
0x0000000000000078 readlink
0x0000000000000080 write
0x0000000000000088 read
0x0000000000000090 open
0x0000000000000098 close
0x00000000000000a0 upxfd_create
0x00000000000000f8 memcpy
0x0000000000000114 my_bkpt
.opd 0x0000000000100de0 0x58
.opd 0x0000000000100de0 0x58 tmp/powerpc64le-linux.elf-main.o
0x0000000000100e20 upx_main
.comment 0x0000000000000000 0x33
.comment 0x0000000000000000 0x33 tmp/powerpc64le-linux.elf-fold.o
.iplt 0x0000000000100e38 0x0
.iplt 0x0000000000100e38 0x0 linker stubs
.note.GNU-stack
0x0000000000000000 0x0
.note.GNU-stack
0x0000000000000000 0x0 tmp/powerpc64le-linux.elf-fold.o
.bss 0x0000000000100e38 0x0
.bss 0x0000000000100e38 0x0 tmp/powerpc64le-linux.elf-fold.o
.bss 0x0000000000100e38 0x0 tmp/powerpc64le-linux.elf-main.o
EXP_HEAD 0x0000000000000000 0xa8
EXP_HEAD 0x0000000000000000 0xa8 tmp/powerpc64le-linux.elf-fold.o
0x0000000000000000 f_expand
EXP_TAIL 0x0000000000000000 0x84
EXP_TAIL 0x0000000000000000 0x84 tmp/powerpc64le-linux.elf-fold.o
0x0000000000000000 eof_nrv
NRV2E 0x0000000000000000 0x154
NRV2E 0x0000000000000000 0x154 tmp/powerpc64le-linux.elf-fold.o
NRV2D 0x0000000000000000 0x13c
NRV2D 0x0000000000000000 0x13c tmp/powerpc64le-linux.elf-fold.o
NRV2B 0x0000000000000000 0xf8
NRV2B 0x0000000000000000 0xf8 tmp/powerpc64le-linux.elf-fold.o
LZMA_ELF00 0x0000000000000000 0x94
LZMA_ELF00 0x0000000000000000 0x94 tmp/powerpc64le-linux.elf-fold.o
LZMA_DEC30 0x0000000000000000 0x28
LZMA_DEC30 0x0000000000000000 0x28 tmp/powerpc64le-linux.elf-fold.o
LZMA_DEC10 0x0000000000000000 0xbb8
LZMA_DEC10 0x0000000000000000 0xbb8 tmp/powerpc64le-linux.elf-fold.o
LZMA_DEC20 0x0000000000000000 0xc74
LZMA_DEC20 0x0000000000000000 0xc74 tmp/powerpc64le-linux.elf-fold.o