ELF layout for page holes when runtime PAGE_SIZE < .p_align

amd64 works
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   Makefile
	modified:   stub/amd64-linux.elf-entry.h
	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/amd64-linux.shlib-init.h
	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/powerpc64-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/src/amd64-linux.shlib-init.S
	modified:   stub/tmp/amd64-linux.elf-entry.bin.dump
	modified:   stub/tmp/amd64-linux.elf-fold.map
	modified:   stub/tmp/amd64-linux.shlib-init.bin.dump
	modified:   stub/tmp/arm64-linux.elf-fold.map
	modified:   stub/tmp/powerpc64-linux.elf-fold.map
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
This commit is contained in:
John Reiser
2020-05-09 08:05:05 -07:00
committed by Markus F.X.J. Oberhumer
parent a3b2cde58d
commit 926481dace
18 changed files with 1562 additions and 1542 deletions
+3 -3
View File
@@ -13,7 +13,7 @@ Idx Name Size VMA LMA File off Algn
8 LZMA_DEC30 00000018 0000000000000000 0000000000000000 000016f5 2**0 CONTENTS, READONLY
9 NRV_TAIL 00000000 0000000000000000 0000000000000000 0000170d 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003a 0000000000000000 0000000000000000 0000170d 2**0 CONTENTS, RELOC, READONLY
11 ELFMAINZ 000000ef 0000000000000000 0000000000000000 00001747 2**0 CONTENTS, RELOC, READONLY
11 ELFMAINZ 000000b1 0000000000000000 0000000000000000 00001747 2**0 CONTENTS, RELOC, READONLY
SYMBOL TABLE:
0000000000000000 l d NRV_HEAD 0000000000000000 NRV_HEAD
0000000000000000 l d LZMA_DEC30 0000000000000000 LZMA_DEC30
@@ -32,7 +32,7 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE
0000000000000003 R_X86_64_PC32 ELFMAINZ+0x00000000000000d2
0000000000000003 R_X86_64_PC32 ELFMAINZ+0x0000000000000094
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
@@ -59,4 +59,4 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE
00000000000000eb R_X86_64_32 O_BINFO
00000000000000ad R_X86_64_32 O_BINFO
+21 -21
View File
@@ -8,33 +8,33 @@ Linker script and memory map
0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x00000000001000bc 0x810
.text 0x00000000001000bc 0x858
*(.text)
.text 0x00000000001000bc 0x189 tmp/amd64-linux.elf-fold.o
0x0000000000100235 munmap
0x000000000010020e mmap
0x000000000010023d write
0x0000000000100241 read
0x0000000000100225 exit
0x0000000000100229 brk
0x0000000000100231 open
0x0000000000100239 mprotect
0x000000000010022d close
*fill* 0x0000000000100245 0x3 00
.text 0x0000000000100248 0x683 tmp/amd64-linux.elf-main.o
0x0000000000100783 upx_main
.text 0x00000000001000bc 0x18d tmp/amd64-linux.elf-fold.o
0x0000000000100239 munmap
0x0000000000100211 mmap
0x0000000000100241 write
0x0000000000100245 read
0x0000000000100229 exit
0x000000000010022d brk
0x0000000000100235 open
0x000000000010023d mprotect
0x0000000000100231 close
*fill* 0x0000000000100249 0x3 00
.text 0x000000000010024c 0x6c6 tmp/amd64-linux.elf-main.o
0x00000000001007ca upx_main
*(.data)
*fill* 0x00000000001008cb 0x1 00
.data 0x00000000001008cc 0x0 tmp/amd64-linux.elf-fold.o
.data 0x00000000001008cc 0x0 tmp/amd64-linux.elf-main.o
*fill* 0x0000000000100912 0x2 00
.data 0x0000000000100914 0x0 tmp/amd64-linux.elf-fold.o
.data 0x0000000000100914 0x0 tmp/amd64-linux.elf-main.o
.data
.bss 0x00000000001008cc 0x0
.bss 0x00000000001008cc 0x0 tmp/amd64-linux.elf-fold.o
.bss 0x00000000001008cc 0x0 tmp/amd64-linux.elf-main.o
.bss 0x0000000000100914 0x0
.bss 0x0000000000100914 0x0 tmp/amd64-linux.elf-fold.o
.bss 0x0000000000100914 0x0 tmp/amd64-linux.elf-main.o
.rela.dyn 0x00000000001008d0 0x0
.rela.dyn 0x0000000000100918 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
+13 -13
View File
@@ -2,18 +2,18 @@ file format elf64-x86-64
Sections:
Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 00000016 0000000000000000 0000000000000000 00000040 2**0 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000066 0000000000000000 0000000000000000 00000056 2**0 CONTENTS, READONLY
2 NRV2E 000000ba 0000000000000000 0000000000000000 000000bc 2**0 CONTENTS, RELOC, READONLY
3 NRV2D 000000a1 0000000000000000 0000000000000000 00000176 2**0 CONTENTS, RELOC, READONLY
4 NRV2B 00000093 0000000000000000 0000000000000000 00000217 2**0 CONTENTS, RELOC, READONLY
5 LZMA_ELF00 00000064 0000000000000000 0000000000000000 000002aa 2**0 CONTENTS, RELOC, READONLY
6 LZMA_DEC10 000009f7 0000000000000000 0000000000000000 0000030e 2**0 CONTENTS, READONLY
7 LZMA_DEC20 000009f7 0000000000000000 0000000000000000 00000d05 2**0 CONTENTS, READONLY
8 LZMA_DEC30 00000018 0000000000000000 0000000000000000 000016fc 2**0 CONTENTS, READONLY
9 NRV_TAIL 00000000 0000000000000000 0000000000000000 00001714 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003a 0000000000000000 0000000000000000 00001714 2**0 CONTENTS, RELOC, READONLY
11 ELFMAINZ 000001b5 0000000000000000 0000000000000000 0000174e 2**0 CONTENTS, READONLY
0 ELFMAINX 00000019 0000000000000000 0000000000000000 00000040 2**0 CONTENTS, RELOC, READONLY
1 NRV_HEAD 00000066 0000000000000000 0000000000000000 00000059 2**0 CONTENTS, READONLY
2 NRV2E 000000ba 0000000000000000 0000000000000000 000000bf 2**0 CONTENTS, RELOC, READONLY
3 NRV2D 000000a1 0000000000000000 0000000000000000 00000179 2**0 CONTENTS, RELOC, READONLY
4 NRV2B 00000093 0000000000000000 0000000000000000 0000021a 2**0 CONTENTS, RELOC, READONLY
5 LZMA_ELF00 00000064 0000000000000000 0000000000000000 000002ad 2**0 CONTENTS, RELOC, READONLY
6 LZMA_DEC10 000009f7 0000000000000000 0000000000000000 00000311 2**0 CONTENTS, READONLY
7 LZMA_DEC20 000009f7 0000000000000000 0000000000000000 00000d08 2**0 CONTENTS, READONLY
8 LZMA_DEC30 00000018 0000000000000000 0000000000000000 000016ff 2**0 CONTENTS, READONLY
9 NRV_TAIL 00000000 0000000000000000 0000000000000000 00001717 2**0 CONTENTS, READONLY
10 ELFMAINY 0000003a 0000000000000000 0000000000000000 00001717 2**0 CONTENTS, RELOC, READONLY
11 ELFMAINZ 000001b5 0000000000000000 0000000000000000 00001751 2**0 CONTENTS, READONLY
SYMBOL TABLE:
0000000000000000 l d NRV_HEAD 0000000000000000 NRV_HEAD
0000000000000000 l d LZMA_DEC30 0000000000000000 LZMA_DEC30
@@ -31,7 +31,7 @@ SYMBOL TABLE:
RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE
000000000000000a R_X86_64_PC32 ELFMAINZ+0x000000000000000d
000000000000000d R_X86_64_PC32 ELFMAINZ+0x000000000000000d
RELOCATION RECORDS FOR [NRV2E]:
OFFSET TYPE VALUE
+14 -14
View File
@@ -8,7 +8,7 @@ Linker script and memory map
0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x00000000001000bc 0x974
.text 0x00000000001000bc 0x9b4
*(.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 0x73c tmp/arm64-linux.elf-main.o
0x00000000001008c8 upx_main
.text 0x00000000001002f4 0x77c tmp/arm64-linux.elf-main.o
0x0000000000100908 upx_main
*(.data)
.data 0x0000000000100a30 0x0 tmp/arm64-linux.elf-fold.o
.data 0x0000000000100a30 0x0 tmp/arm64-linux.elf-main.o
.data 0x0000000000100a70 0x0 tmp/arm64-linux.elf-fold.o
.data 0x0000000000100a70 0x0 tmp/arm64-linux.elf-main.o
.iplt 0x0000000000100a30 0x0
.iplt 0x0000000000100a30 0x0 tmp/arm64-linux.elf-fold.o
.iplt 0x0000000000100a70 0x0
.iplt 0x0000000000100a70 0x0 tmp/arm64-linux.elf-fold.o
.rela.dyn 0x0000000000100a30 0x0
.rela.iplt 0x0000000000100a30 0x0 tmp/arm64-linux.elf-fold.o
.rela.dyn 0x0000000000100a70 0x0
.rela.iplt 0x0000000000100a70 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 0x0000000000100a30 0x0
.igot.plt 0x0000000000100a30 0x0 tmp/arm64-linux.elf-fold.o
.igot.plt 0x0000000000100a70 0x0
.igot.plt 0x0000000000100a70 0x0 tmp/arm64-linux.elf-fold.o
.bss 0x0000000000100a30 0x0
.bss 0x0000000000100a30 0x0 tmp/arm64-linux.elf-fold.o
.bss 0x0000000000100a30 0x0 tmp/arm64-linux.elf-main.o
.bss 0x0000000000100a70 0x0
.bss 0x0000000000100a70 0x0 tmp/arm64-linux.elf-fold.o
.bss 0x0000000000100a70 0x0 tmp/arm64-linux.elf-main.o
+30 -30
View File
@@ -9,7 +9,7 @@ Linker script and memory map
TARGET(elf64-powerpc)
0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x00000000001000bc 0xb04
.text 0x00000000001000bc 0xb4c
*(.text)
.text 0x00000000001000bc 0x30c tmp/powerpc64-linux.elf-fold.o
0x00000000001000bc get_page_mask
@@ -23,47 +23,47 @@ TARGET(elf64-powerpc)
0x00000000001003b0 mprotect
0x00000000001003b8 munmap
0x00000000001003c0 my_bkpt
.text 0x00000000001003c8 0x7f8 tmp/powerpc64-linux.elf-main.o
.text 0x00000000001003c8 0x840 tmp/powerpc64-linux.elf-main.o
*(.data)
.data 0x0000000000100bc0 0x0 tmp/powerpc64-linux.elf-fold.o
.data 0x0000000000100bc0 0x0 tmp/powerpc64-linux.elf-main.o
.data 0x0000000000100c08 0x0 tmp/powerpc64-linux.elf-fold.o
.data 0x0000000000100c08 0x0 tmp/powerpc64-linux.elf-main.o
.sfpr 0x0000000000100bc0 0xa4
.sfpr 0x0000000000100bc0 0xa4 linker stubs
0x0000000000100bc0 _savegpr0_14
0x0000000000100be8 _savegpr0_24
0x0000000000100bf8 _savegpr0_28
0x0000000000100c10 _restgpr0_14
0x0000000000100c38 _restgpr0_24
0x0000000000100c48 _restgpr0_28
.sfpr 0x0000000000100c08 0xa4
.sfpr 0x0000000000100c08 0xa4 linker stubs
0x0000000000100c08 _savegpr0_14
0x0000000000100c30 _savegpr0_24
0x0000000000100c40 _savegpr0_28
0x0000000000100c58 _restgpr0_14
0x0000000000100c80 _restgpr0_24
0x0000000000100c90 _restgpr0_28
.glink 0x0000000000100c68 0x0
.glink 0x0000000000100c68 0x0 linker stubs
.glink 0x0000000000100cb0 0x0
.glink 0x0000000000100cb0 0x0 linker stubs
.eh_frame 0x0000000000100c64 0x0
.eh_frame 0x0000000000100c64 0x0 linker stubs
.eh_frame 0x0000000000100cac 0x0
.eh_frame 0x0000000000100cac 0x0 linker stubs
.rela.dyn 0x0000000000100c68 0x0
.rela.iplt 0x0000000000100c68 0x0 linker stubs
.rela.dyn 0x0000000000100cb0 0x0
.rela.iplt 0x0000000000100cb0 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 0x0000000000100c68 0x0
.branch_lt 0x0000000000100c68 0x0 linker stubs
.branch_lt 0x0000000000100cb0 0x0
.branch_lt 0x0000000000100cb0 0x0 linker stubs
.toc 0x0000000000100c68 0x0
.toc 0x0000000000100c68 0x0 tmp/powerpc64-linux.elf-main.o
.toc 0x0000000000100cb0 0x0
.toc 0x0000000000100cb0 0x0 tmp/powerpc64-linux.elf-main.o
.opd 0x0000000000100c68 0x58
.opd 0x0000000000100c68 0x58 tmp/powerpc64-linux.elf-main.o
0x0000000000100ca8 upx_main
.opd 0x0000000000100cb0 0x58
.opd 0x0000000000100cb0 0x58 tmp/powerpc64-linux.elf-main.o
0x0000000000100cf0 upx_main
.iplt 0x0000000000100cc0 0x0
.iplt 0x0000000000100cc0 0x0 linker stubs
.iplt 0x0000000000100d08 0x0
.iplt 0x0000000000100d08 0x0 linker stubs
.bss 0x0000000000100cc0 0x0
.bss 0x0000000000100cc0 0x0 tmp/powerpc64-linux.elf-fold.o
.bss 0x0000000000100cc0 0x0 tmp/powerpc64-linux.elf-main.o
.bss 0x0000000000100d08 0x0
.bss 0x0000000000100d08 0x0 tmp/powerpc64-linux.elf-fold.o
.bss 0x0000000000100d08 0x0 tmp/powerpc64-linux.elf-main.o
+30 -30
View File
@@ -9,7 +9,7 @@ Linker script and memory map
TARGET(elf64-powerpcle)
0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc)
.text 0x00000000001000bc 0xb00
.text 0x00000000001000bc 0xb48
*(.text)
.text 0x00000000001000bc 0x30c tmp/powerpc64le-linux.elf-fold.o
0x00000000001000bc get_page_mask
@@ -23,47 +23,47 @@ TARGET(elf64-powerpcle)
0x00000000001003b0 mprotect
0x00000000001003b8 munmap
0x00000000001003c0 my_bkpt
.text 0x00000000001003c8 0x7f4 tmp/powerpc64le-linux.elf-main.o
.text 0x00000000001003c8 0x83c tmp/powerpc64le-linux.elf-main.o
*(.data)
.data 0x0000000000100bbc 0x0 tmp/powerpc64le-linux.elf-fold.o
.data 0x0000000000100bbc 0x0 tmp/powerpc64le-linux.elf-main.o
.data 0x0000000000100c04 0x0 tmp/powerpc64le-linux.elf-fold.o
.data 0x0000000000100c04 0x0 tmp/powerpc64le-linux.elf-main.o
.sfpr 0x0000000000100bbc 0xa4
.sfpr 0x0000000000100bbc 0xa4 linker stubs
0x0000000000100bbc _savegpr0_14
0x0000000000100be4 _savegpr0_24
0x0000000000100bf4 _savegpr0_28
0x0000000000100c0c _restgpr0_14
0x0000000000100c34 _restgpr0_24
0x0000000000100c44 _restgpr0_28
.sfpr 0x0000000000100c04 0xa4
.sfpr 0x0000000000100c04 0xa4 linker stubs
0x0000000000100c04 _savegpr0_14
0x0000000000100c2c _savegpr0_24
0x0000000000100c3c _savegpr0_28
0x0000000000100c54 _restgpr0_14
0x0000000000100c7c _restgpr0_24
0x0000000000100c8c _restgpr0_28
.glink 0x0000000000100c60 0x0
.glink 0x0000000000100c60 0x0 linker stubs
.glink 0x0000000000100ca8 0x0
.glink 0x0000000000100ca8 0x0 linker stubs
.eh_frame 0x0000000000100c60 0x0
.eh_frame 0x0000000000100c60 0x0 linker stubs
.eh_frame 0x0000000000100ca8 0x0
.eh_frame 0x0000000000100ca8 0x0 linker stubs
.rela.dyn 0x0000000000100c60 0x0
.rela.iplt 0x0000000000100c60 0x0 linker stubs
.rela.dyn 0x0000000000100ca8 0x0
.rela.iplt 0x0000000000100ca8 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 0x0000000000100c60 0x0
.branch_lt 0x0000000000100c60 0x0 linker stubs
.branch_lt 0x0000000000100ca8 0x0
.branch_lt 0x0000000000100ca8 0x0 linker stubs
.toc 0x0000000000100c60 0x0
.toc 0x0000000000100c60 0x0 tmp/powerpc64le-linux.elf-main.o
.toc 0x0000000000100ca8 0x0
.toc 0x0000000000100ca8 0x0 tmp/powerpc64le-linux.elf-main.o
.opd 0x0000000000100c60 0x58
.opd 0x0000000000100c60 0x58 tmp/powerpc64le-linux.elf-main.o
0x0000000000100ca0 upx_main
.opd 0x0000000000100ca8 0x58
.opd 0x0000000000100ca8 0x58 tmp/powerpc64le-linux.elf-main.o
0x0000000000100ce8 upx_main
.iplt 0x0000000000100cb8 0x0
.iplt 0x0000000000100cb8 0x0 linker stubs
.iplt 0x0000000000100d00 0x0
.iplt 0x0000000000100d00 0x0 linker stubs
.bss 0x0000000000100cb8 0x0
.bss 0x0000000000100cb8 0x0 tmp/powerpc64le-linux.elf-fold.o
.bss 0x0000000000100cb8 0x0 tmp/powerpc64le-linux.elf-main.o
.bss 0x0000000000100d00 0x0
.bss 0x0000000000100d00 0x0 tmp/powerpc64le-linux.elf-fold.o
.bss 0x0000000000100d00 0x0 tmp/powerpc64le-linux.elf-main.o