Android build environment post-processing is adding a PT_NOTE
("Android", 21, "r16-beta1") at the high end of PT_LOAD[0],
above the stub; the runtime linker looks there before de-compression.
https://github.com/upx/upx/issues/124
modified: p_lx_elf.cpp
(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
modified: p_lx_elf.cpp
modified: stub/Makefile
new file: stub/mips.r3000-linux.shlib-init.h
new file: stub/mipsel.r3000-linux.shlib-init.h
new file: stub/src/mips.r3000-linux.shlib-init.S
new file: stub/src/mipsel.r3000-linux.shlib-init.S
new file: stub/tmp/mips.r3000-linux.shlib-init.bin.dump
new file: stub/tmp/mipsel.r3000-linux.shlib-init.bin.dump
New stub strategy on Linux: Linux adds too many other segments
to the address space: [vdso], [sigpage], ...; and qemu might
arrange them differently. Thus the only reliable mappings
are the PT_LOAD of the compressed file itself; all other
address space is unknown! First, the compressed file uses
.bss to occupy all unused pages up to the original brk(0).
Then at run time, the stub gets another mapping of /proc/self/exe,
and uncompresses the user program on top of the original pages.
[*BSD unchanged for now?]
modified: stub/src/powerpc64le-linux.elf-fold.S
modified: stub/src/powerpc64le-linux.elf-entry.S
modified: stub/src/powerpc64le-darwin.macho-entry.S
modified: stub/src/powerpc64le-darwin.dylib-entry.S
modified: stub/src/powerpc-linux.elf-fold.S
modified: stub/src/powerpc-linux.elf-entry.S
modified: stub/src/mipsel.r3000-linux.elf-fold.S
modified: stub/src/mipsel.r3000-linux.elf-entry.S
modified: stub/src/i386-linux.elf-main.c
modified: stub/src/i386-linux.elf-fold.S
modified: stub/src/i386-linux.elf-entry.S
modified: stub/src/arm64-linux.elf-main.c
modified: stub/src/arm64-linux.elf-fold.S
modified: stub/src/arm64-linux.elf-entry.S
modified: stub/src/arm.v4a-linux.elf-fold.S
modified: stub/src/arm.v4a-linux.elf-entry.S
modified: stub/src/amd64-linux.elf-main.c
modified: stub/src/amd64-linux.elf-fold.S
modified: stub/src/amd64-linux.elf-entry.S
modified: p_unix.cpp
modified: p_mach.cpp
modified: p_lx_sh.cpp
modified: p_lx_interp.cpp
modified: p_lx_elf.cpp
modified: p_lx_elf.h
modified: p_lx_interp.h
modified: p_lx_sh.h
modified: p_mach.h
modified: p_unix.h
modified: stub/src/arch/mips/r3000/macros.ash
modified: stub/src/arch/powerpc/32/ppc_regs.h
modified: stub/src/arch/powerpc/64le/ppc_regs.h
modified: stub/src/include/linux.h
modified: stub/Makefile
modified: ../.github/travis_testsuite_1.sh
also .h .map .bin.dump
First mmap must reserve enough space to decompress folded stub.
modified: stub/src/powerpc-linux.elf-entry.S
modified: stub/src/powerpc-linux.elf-fold.S
also .h, .map, .dump
The stub occupies the same region that execve() would create
for the original progam. The stub copies everything to a new area,
erases the original region, replaces it with the de-compressed
program, and erases the copy of itself via the escape hatch.
The copy is inexpensive via mmap() of /proc/self/exe.
modified: stub/src/i386-linux.elf-entry.S
modified: stub/src/i386-linux.elf-fold.S
modified: stub/src/i386-linux.elf-main.c
modified: p_lx_elf.cpp
modified: p_lx_elf.h
modified: p_lx_interp.cpp
modified: p_lx_interp.h
modified: p_lx_sh.cpp
modified: p_lx_sh.h
modified: p_mach.cpp
modified: p_mach.h
modified: p_unix.cpp
modified: p_unix.h
modified: p_vmlinx.cpp
plus .h, .map, .dump
modified: stub/src/mipsel.r3000-linux.elf-entry.S
modified: stub/src/mipsel.r3000-linux.elf-fold.S
plus associated *.h, *.bin.dump, and ../.github/travis_testsuite_1.sh