PowerPC64 stub: on syscall, real Linux trashes r13 and below

(except r1, r2, and input args!) So, r12 .e_entry for musl
must copy from a saved register.  [qemu-ppc64 doesn't trash registers!]
	modified:   ../.github/travis_testsuite_1.sh
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	also .h  .fold.map
This commit is contained in:
John Reiser
2017-10-27 20:07:32 -07:00
parent bb8e607442
commit 0430e7931e
12 changed files with 621 additions and 610 deletions
+9 -10
View File
@@ -8,7 +8,7 @@ Linker script and memory map
0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x00000000001000bc 0x7b0
.text 0x00000000001000bc 0x7a8
*(.text)
.text 0x00000000001000bc 0x186 tmp/amd64-linux.elf-fold.o
0x0000000000100232 munmap
@@ -21,20 +21,19 @@ Linker script and memory map
0x0000000000100236 mprotect
0x000000000010022a close
*fill* 0x0000000000100242 0x2 00
.text 0x0000000000100244 0x627 tmp/amd64-linux.elf-main.o
0x0000000000100723 upx_main
.text 0x0000000000100244 0x620 tmp/amd64-linux.elf-main.o
0x000000000010071c upx_main
*(.data)
*fill* 0x000000000010086b 0x1 00
.data 0x000000000010086c 0x0 tmp/amd64-linux.elf-fold.o
.data 0x000000000010086c 0x0 tmp/amd64-linux.elf-main.o
.data 0x0000000000100864 0x0 tmp/amd64-linux.elf-fold.o
.data 0x0000000000100864 0x0 tmp/amd64-linux.elf-main.o
.data
.bss 0x000000000010086c 0x0
.bss 0x000000000010086c 0x0 tmp/amd64-linux.elf-fold.o
.bss 0x000000000010086c 0x0 tmp/amd64-linux.elf-main.o
.bss 0x0000000000100864 0x0
.bss 0x0000000000100864 0x0 tmp/amd64-linux.elf-fold.o
.bss 0x0000000000100864 0x0 tmp/amd64-linux.elf-main.o
.rela.dyn 0x0000000000100870 0x0
.rela.dyn 0x0000000000100868 0x0
.rela.text 0x0000000000000000 0x0 tmp/amd64-linux.elf-fold.o
LOAD tmp/amd64-linux.elf-fold.o
LOAD tmp/amd64-linux.elf-main.o
+14 -14
View File
@@ -8,7 +8,7 @@ Linker script and memory map
0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x00000000001000bc 0x934
.text 0x00000000001000bc 0x920
*(.text)
.text 0x00000000001000bc 0x238 tmp/arm64-linux.elf-fold.o
0x0000000000100228 my_bkpt
@@ -26,26 +26,26 @@ Linker script and memory map
0x00000000001002bc readlink
0x00000000001002c4 open
0x00000000001002e0 __clear_cache
.text 0x00000000001002f4 0x6fc tmp/arm64-linux.elf-main.o
0x0000000000100888 upx_main
.text 0x00000000001002f4 0x6e8 tmp/arm64-linux.elf-main.o
0x0000000000100874 upx_main
*(.data)
.data 0x00000000001009f0 0x0 tmp/arm64-linux.elf-fold.o
.data 0x00000000001009f0 0x0 tmp/arm64-linux.elf-main.o
.data 0x00000000001009dc 0x0 tmp/arm64-linux.elf-fold.o
.data 0x00000000001009dc 0x0 tmp/arm64-linux.elf-main.o
.iplt 0x00000000001009f0 0x0
.iplt 0x00000000001009f0 0x0 tmp/arm64-linux.elf-fold.o
.iplt 0x00000000001009dc 0x0
.iplt 0x00000000001009dc 0x0 tmp/arm64-linux.elf-fold.o
.rela.dyn 0x00000000001009f0 0x0
.rela.iplt 0x00000000001009f0 0x0 tmp/arm64-linux.elf-fold.o
.rela.dyn 0x00000000001009e0 0x0
.rela.iplt 0x00000000001009e0 0x0 tmp/arm64-linux.elf-fold.o
.data
LOAD tmp/arm64-linux.elf-fold.o
LOAD tmp/arm64-linux.elf-main.o
OUTPUT(tmp/arm64-linux.elf-fold.bin elf64-littleaarch64)
.igot.plt 0x00000000001009f0 0x0
.igot.plt 0x00000000001009f0 0x0 tmp/arm64-linux.elf-fold.o
.igot.plt 0x00000000001009e0 0x0
.igot.plt 0x00000000001009e0 0x0 tmp/arm64-linux.elf-fold.o
.bss 0x00000000001009f0 0x0
.bss 0x00000000001009f0 0x0 tmp/arm64-linux.elf-fold.o
.bss 0x00000000001009f0 0x0 tmp/arm64-linux.elf-main.o
.bss 0x00000000001009dc 0x0
.bss 0x00000000001009dc 0x0 tmp/arm64-linux.elf-fold.o
.bss 0x00000000001009dc 0x0 tmp/arm64-linux.elf-main.o
+41 -41
View File
@@ -9,61 +9,61 @@ Linker script and memory map
TARGET(elf64-powerpc)
0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x00000000001000bc 0xa94
.text 0x00000000001000bc 0xaa8
*(.text)
.text 0x00000000001000bc 0x304 tmp/powerpc64-linux.elf-fold.o
.text 0x00000000001000bc 0x30c tmp/powerpc64-linux.elf-fold.o
0x00000000001000bc get_page_mask
0x0000000000100360 mmap
0x0000000000100378 exit
0x0000000000100380 brk
0x0000000000100388 readlink
0x0000000000100390 read
0x0000000000100398 open
0x00000000001003a0 close
0x00000000001003a8 mprotect
0x00000000001003b0 munmap
0x00000000001003b8 my_bkpt
.text 0x00000000001003c0 0x790 tmp/powerpc64-linux.elf-main.o
0x0000000000100368 mmap
0x0000000000100380 exit
0x0000000000100388 brk
0x0000000000100390 readlink
0x0000000000100398 read
0x00000000001003a0 open
0x00000000001003a8 close
0x00000000001003b0 mprotect
0x00000000001003b8 munmap
0x00000000001003c0 my_bkpt
.text 0x00000000001003c8 0x79c tmp/powerpc64-linux.elf-main.o
*(.data)
.data 0x0000000000100b50 0x0 tmp/powerpc64-linux.elf-fold.o
.data 0x0000000000100b50 0x0 tmp/powerpc64-linux.elf-main.o
.data 0x0000000000100b64 0x0 tmp/powerpc64-linux.elf-fold.o
.data 0x0000000000100b64 0x0 tmp/powerpc64-linux.elf-main.o
.sfpr 0x0000000000100b50 0xa4
.sfpr 0x0000000000100b50 0xa4 linker stubs
0x0000000000100b50 _savegpr0_14
0x0000000000100b78 _savegpr0_24
0x0000000000100b88 _savegpr0_28
0x0000000000100ba0 _restgpr0_14
0x0000000000100bc8 _restgpr0_24
0x0000000000100bd8 _restgpr0_28
.sfpr 0x0000000000100b64 0xa4
.sfpr 0x0000000000100b64 0xa4 linker stubs
0x0000000000100b64 _savegpr0_14
0x0000000000100b8c _savegpr0_24
0x0000000000100b9c _savegpr0_28
0x0000000000100bb4 _restgpr0_14
0x0000000000100bdc _restgpr0_24
0x0000000000100bec _restgpr0_28
.glink 0x0000000000100bf8 0x0
.glink 0x0000000000100bf8 0x0 linker stubs
.glink 0x0000000000100c08 0x0
.glink 0x0000000000100c08 0x0 linker stubs
.eh_frame 0x0000000000100bf4 0x0
.eh_frame 0x0000000000100bf4 0x0 linker stubs
.eh_frame 0x0000000000100c08 0x0
.eh_frame 0x0000000000100c08 0x0 linker stubs
.rela.dyn 0x0000000000100bf8 0x0
.rela.iplt 0x0000000000100bf8 0x0 linker stubs
.rela.dyn 0x0000000000100c08 0x0
.rela.iplt 0x0000000000100c08 0x0 linker stubs
.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 0x0000000000100bf8 0x0
.branch_lt 0x0000000000100bf8 0x0 linker stubs
.branch_lt 0x0000000000100c08 0x0
.branch_lt 0x0000000000100c08 0x0 linker stubs
.toc 0x0000000000100bf8 0x0
.toc 0x0000000000100bf8 0x0 tmp/powerpc64-linux.elf-main.o
.toc 0x0000000000100c08 0x0
.toc 0x0000000000100c08 0x0 tmp/powerpc64-linux.elf-main.o
.opd 0x0000000000100bf8 0x58
.opd 0x0000000000100bf8 0x58 tmp/powerpc64-linux.elf-main.o
0x0000000000100c38 upx_main
.opd 0x0000000000100c08 0x58
.opd 0x0000000000100c08 0x58 tmp/powerpc64-linux.elf-main.o
0x0000000000100c48 upx_main
.iplt 0x0000000000100c50 0x0
.iplt 0x0000000000100c50 0x0 linker stubs
.iplt 0x0000000000100c60 0x0
.iplt 0x0000000000100c60 0x0 linker stubs
.bss 0x0000000000100c50 0x0
.bss 0x0000000000100c50 0x0 tmp/powerpc64-linux.elf-fold.o
.bss 0x0000000000100c50 0x0 tmp/powerpc64-linux.elf-main.o
.bss 0x0000000000100c60 0x0
.bss 0x0000000000100c60 0x0 tmp/powerpc64-linux.elf-fold.o
.bss 0x0000000000100c60 0x0 tmp/powerpc64-linux.elf-main.o
+41 -41
View File
@@ -9,61 +9,61 @@ Linker script and memory map
TARGET(elf64-powerpcle)
0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x00000000001000bc 0xa90
.text 0x00000000001000bc 0xaa4
*(.text)
.text 0x00000000001000bc 0x304 tmp/powerpc64le-linux.elf-fold.o
.text 0x00000000001000bc 0x30c tmp/powerpc64le-linux.elf-fold.o
0x00000000001000bc get_page_mask
0x0000000000100360 mmap
0x0000000000100378 exit
0x0000000000100380 brk
0x0000000000100388 readlink
0x0000000000100390 read
0x0000000000100398 open
0x00000000001003a0 close
0x00000000001003a8 mprotect
0x00000000001003b0 munmap
0x00000000001003b8 my_bkpt
.text 0x00000000001003c0 0x78c tmp/powerpc64le-linux.elf-main.o
0x0000000000100368 mmap
0x0000000000100380 exit
0x0000000000100388 brk
0x0000000000100390 readlink
0x0000000000100398 read
0x00000000001003a0 open
0x00000000001003a8 close
0x00000000001003b0 mprotect
0x00000000001003b8 munmap
0x00000000001003c0 my_bkpt
.text 0x00000000001003c8 0x798 tmp/powerpc64le-linux.elf-main.o
*(.data)
.data 0x0000000000100b4c 0x0 tmp/powerpc64le-linux.elf-fold.o
.data 0x0000000000100b4c 0x0 tmp/powerpc64le-linux.elf-main.o
.data 0x0000000000100b60 0x0 tmp/powerpc64le-linux.elf-fold.o
.data 0x0000000000100b60 0x0 tmp/powerpc64le-linux.elf-main.o
.sfpr 0x0000000000100b4c 0xa4
.sfpr 0x0000000000100b4c 0xa4 linker stubs
0x0000000000100b4c _savegpr0_14
0x0000000000100b74 _savegpr0_24
0x0000000000100b84 _savegpr0_28
0x0000000000100b9c _restgpr0_14
0x0000000000100bc4 _restgpr0_24
0x0000000000100bd4 _restgpr0_28
.sfpr 0x0000000000100b60 0xa4
.sfpr 0x0000000000100b60 0xa4 linker stubs
0x0000000000100b60 _savegpr0_14
0x0000000000100b88 _savegpr0_24
0x0000000000100b98 _savegpr0_28
0x0000000000100bb0 _restgpr0_14
0x0000000000100bd8 _restgpr0_24
0x0000000000100be8 _restgpr0_28
.glink 0x0000000000100bf0 0x0
.glink 0x0000000000100bf0 0x0 linker stubs
.glink 0x0000000000100c08 0x0
.glink 0x0000000000100c08 0x0 linker stubs
.eh_frame 0x0000000000100bf0 0x0
.eh_frame 0x0000000000100bf0 0x0 linker stubs
.eh_frame 0x0000000000100c04 0x0
.eh_frame 0x0000000000100c04 0x0 linker stubs
.rela.dyn 0x0000000000100bf0 0x0
.rela.iplt 0x0000000000100bf0 0x0 linker stubs
.rela.dyn 0x0000000000100c08 0x0
.rela.iplt 0x0000000000100c08 0x0 linker stubs
.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 0x0000000000100bf0 0x0
.branch_lt 0x0000000000100bf0 0x0 linker stubs
.branch_lt 0x0000000000100c08 0x0
.branch_lt 0x0000000000100c08 0x0 linker stubs
.toc 0x0000000000100bf0 0x0
.toc 0x0000000000100bf0 0x0 tmp/powerpc64le-linux.elf-main.o
.toc 0x0000000000100c08 0x0
.toc 0x0000000000100c08 0x0 tmp/powerpc64le-linux.elf-main.o
.opd 0x0000000000100bf0 0x58
.opd 0x0000000000100bf0 0x58 tmp/powerpc64le-linux.elf-main.o
0x0000000000100c30 upx_main
.opd 0x0000000000100c08 0x58
.opd 0x0000000000100c08 0x58 tmp/powerpc64le-linux.elf-main.o
0x0000000000100c48 upx_main
.iplt 0x0000000000100c48 0x0
.iplt 0x0000000000100c48 0x0 linker stubs
.iplt 0x0000000000100c60 0x0
.iplt 0x0000000000100c60 0x0 linker stubs
.bss 0x0000000000100c48 0x0
.bss 0x0000000000100c48 0x0 tmp/powerpc64le-linux.elf-fold.o
.bss 0x0000000000100c48 0x0 tmp/powerpc64le-linux.elf-main.o
.bss 0x0000000000100c60 0x0
.bss 0x0000000000100c60 0x0 tmp/powerpc64le-linux.elf-fold.o
.bss 0x0000000000100c60 0x0 tmp/powerpc64le-linux.elf-main.o