diff --git a/src/stub/Makefile b/src/stub/Makefile index 8a993414..cfead4f0 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -121,21 +121,14 @@ STUBS += powerpc-linux.elf-entry.h STUBS += powerpc-linux.elf-fold.h STUBS += powerpc-linux.kernel.vmlinux-head.h STUBS += powerpc-linux.kernel.vmlinux.h - -# Need a UPX-standard compiler for ppc64le ! STUBS += ppc64le-darwin.dylib-entry.h STUBS += ppc64le-darwin.macho-entry.h #STUBS += ppc64le-darwin.macho-fold.h -# undefined reference to `_savegpr0_28' `_restgpr0_28' `_savegpr0_16' `_restgpr0_16' `_savegpr0_27' `_restgpr0_27' - STUBS += ppc64le-linux.elf-entry.h -#STUBS += ppc64le-linux.elf-fold.h -# SIGSEGV: bin-upx-20130920/multiarch-ld-2.17 -b elf64-powerpcle --strip-all -T ./src/ppc64le-linux.elf-fold.lds -Map tmp/ppc64le-linux.elf-fold.map tmp/ppc64le-linux.elf-fold.o tmp/ppc64le-linux.elf-main.o -o tmp/ppc64le-linux.elf-fold.bin - +STUBS += ppc64le-linux.elf-fold.h STUBS += ppc64le-linux.kernel.vmlinux-head.h STUBS += ppc64le-linux.kernel.vmlinux.h - -#STUBS += thumb-eabi-linux.shlib-init.h +STUBS += thumb-eabi-linux.shlib-init.h endif @@ -154,8 +147,9 @@ endif all.targets ?= .upx-stubtools-stamp tmp/.tmp-stamp .all-stamp all: $$(all.targets) .upx-stubtools-stamp: $(MAKEFILE_LIST) - upx-stubtools-check-version 20160902 + upx-stubtools-check-version 20160918 @echo "timestamp" > $@ +.DELETE_ON_ERROR: .upx-stubtools-stamp %/.tmp-stamp: @mkdir -p $(dir $@) @echo "timestamp" > $@ @@ -234,7 +228,7 @@ tc.default.brandelf = $(PYTHON) $(top_srcdir)/src/stub/scripts/brandelf.py $(i tc.default.gpp_inc = $(PYTHON) $(top_srcdir)/src/stub/scripts/gpp_inc.py tc.default.gpp_mkdep = $(PYTHON) $(top_srcdir)/src/stub/scripts/gpp_inc.py -o /dev/null tc.default.pp-as = i386-linux-gcc-3.4.6 -E -nostdinc -x assembler-with-cpp -Wall -tc.default.sstrip = sstrip +tc.default.sstrip = sstrip-20060518 tc.default.xstrip = $(PYTHON) $(top_srcdir)/src/stub/scripts/xstrip.py # default multiarch-binutils @@ -277,7 +271,7 @@ endef tc.arch-i086.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD -MT $@ tc.arch-i086.wdis = $(WATCOM)/binl/wdis tc.arch-i386.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD -MT $@ -tc.arch-i386.djasm = djasm +tc.arch-i386.djasm = djasm-20060614 # /*********************************************************************** @@ -444,19 +438,19 @@ tmp/arm-darwin.macho-main.o : $(srcdir)/src/$$T.c # info: we use the tc settings from arm64-linux.elf, but override v4 with v5 arm64-darwin.macho%.h : tc_list = arm64-linux.elf default arm64-darwin.macho%.h : tc_bfdname = elf64-littleaarch64 -tc.arm64-darwin.macho-entry.gcc = /usr/bin/aarch64-linux-gnu-gcc -nostdinc -MMD -MT $@ -tc.arm64-darwin.macho-fold.gcc = /usr/bin/aarch64-linux-gnu-gcc -nostdinc -MMD -MT $@ -tc.arm64-darwin.macho-main.gcc = /usr/bin/aarch64-linux-gnu-gcc -nostdinc -MMD -MT $@ +tc.arm64-darwin.macho-entry.gcc = arm64-linux-gcc-4.9.2 -nostdinc -MMD -MT $@ +tc.arm64-darwin.macho-fold.gcc = $(tc.arm64-darwin.macho-entry.gcc) +tc.arm64-darwin.macho-main.gcc = $(tc.arm64-darwin.macho-entry.gcc) -tc.arm64-darwin.macho-fold.ld = /usr/bin/aarch64-linux-gnu-ld +tc.arm64-darwin.macho-fold.ld = arm64-linux-ld-2.25 -tc.arm64-darwin.macho-entry.objcopy = /usr/bin/aarch64-linux-gnu-objcopy -F elf64-littleaarch64 -tc.arm64-darwin.macho-fold.objcopy = /usr/bin/aarch64-linux-gnu-objcopy -F elf64-littleaarch64 -tc.arm64-darwin.macho-main.objcopy = /usr/bin/aarch64-linux-gnu-objcopy -F elf64-littleaarch64 +tc.arm64-darwin.macho-entry.objcopy = arm64-linux-objcopy-2.25 -F elf64-littleaarch64 +tc.arm64-darwin.macho-fold.objcopy = $(tc.arm64-darwin.macho-entry.objcopy) +tc.arm64-darwin.macho-main.objcopy = $(tc.arm64-darwin.macho-entry.objcopy) -tc.arm64-darwin.macho-entry.objdump = /usr/bin/aarch64-linux-gnu-objdump -tc.arm64-darwin.macho-fold.objdump = /usr/bin/aarch64-linux-gnu-objdump -tc.arm64-darwin.macho-main.objdump = /usr/bin/aarch64-linux-gnu-objdump +tc.arm64-darwin.macho-entry.objdump = arm64-linux-objdump-2.25 +tc.arm64-darwin.macho-fold.objdump = $(tc.arm64-darwin.macho-entry.objdump) +tc.arm64-darwin.macho-main.objdump = $(tc.arm64-darwin.macho-entry.objdump) arm64-darwin.macho-entry.h : $(srcdir)/src/$$T.S $(call tc,gcc) -c $< -o tmp/$T.bin @@ -466,6 +460,7 @@ arm64-darwin.macho-entry.h : $(srcdir)/src/$$T.S arm64-darwin.macho-fold.h : tmp/$$T.o tmp/arm64-darwin.macho-main.o $(call tc,ld) --no-warn-mismatch --strip-all -Map tmp/$T.map $(filter %.o,$^) -o tmp/$T.tmp $(call tc,objcopy) -O binary tmp/$T.tmp tmp/$T.bin + rm tmp/$T.tmp chmod a-x tmp/$T.bin $(call tc,bin2h) tmp/$T.bin $@ @@ -1307,14 +1302,17 @@ powerpc-linux.kernel.vmlinux-head.h : $(srcdir)/src/$$T.S $(call tc,objcopy) --output-target binary --only-section .text tmp/$T.o tmp/$T.bin $(call tc,bin2h) tmp/$T.bin $@ + # /*********************************************************************** # // ppc64le-darwin.macho # ************************************************************************/ # info: we use the tc settings from ppc64le-linux.elf -ppc64le-darwin.macho%.h : tc_list = ppc64le-linux.elf default +ppc64le-darwin.macho%.h : tc_list = ppc64le-darwin.macho ppc64le-linux.elf default ppc64le-darwin.macho%.h : tc_bfdname = elf64-powerpcle +tc.ppc64le-darwin.macho.ld = multiarch-ld-2.27 -b $(tc_bfdname) + ppc64le-darwin.macho-entry.h : $(srcdir)/src/$$T.S $(call tc,gcc) -c $< -o tmp/$T.bin $(call tc,f-embed_objinfo,tmp/$T.bin) @@ -1355,10 +1353,12 @@ ppc64le-darwin.dylib-entry.h : $(srcdir)/src/$$T.S ppc64le-linux.elf%.h : tc_list = ppc64le-linux.elf default ppc64le-linux.elf%.h : tc_bfdname = elf64-powerpcle -tc.ppc64le-linux.elf.gcc = ppc64-linux-gnu-gcc -m64 -mlittle-endian -nostdinc -MMD -MT $@ +tc.ppc64le-linux.elf.gcc = powerpc64-linux-gcc-4.9.2 -m64 -mlittle-endian -nostdinc -MMD -MT $@ tc.ppc64le-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables -fno-stack-protector tc.ppc64le-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror +tc.ppc64le-linux.elf.ld = powerpc64-linux-ld-2.25 -b $(tc_bfdname) + ppc64le-linux.elf-entry.h : $(srcdir)/src/$$T.S $(call tc,gcc) -c $< -o tmp/$T.bin $(call tc,f-embed_objinfo,tmp/$T.bin) diff --git a/src/stub/src/c/Makevars.lzma b/src/stub/src/c/Makevars.lzma old mode 100755 new mode 100644 diff --git a/src/stub/src/ppc64le-darwin.macho-main.c b/src/stub/src/ppc64le-darwin.macho-main.c index 2cdf3236..894f47e3 100644 --- a/src/stub/src/ppc64le-darwin.macho-main.c +++ b/src/stub/src/ppc64le-darwin.macho-main.c @@ -334,7 +334,7 @@ do_xmap( unsigned j; for ( j=0; j < mhdr->ncmds; ++j, - (sc = (Mach_segment_command const *)(sc->cmdsize + (char const *)sc)) + (sc = (Mach_segment_command const *)(void const *)(sc->cmdsize + (char const *)sc)) ) if (LC_SEGMENT==sc->cmd) { Extent xo; size_t mlen = xo.size = sc->filesize; @@ -352,7 +352,7 @@ do_xmap( } if (xi && 0!=sc->filesize) { if (0==sc->fileoff /*&& 0!=mhdrpp*/) { - *mhdrpp = (Mach_header *)addr; + *mhdrpp = (Mach_header *)(void *)addr; } unpackExtent(xi, &xo, f_decompress, f_unf); } @@ -404,7 +404,7 @@ upx_main( xi.buf = CONST_CAST(char *, 1+ (struct p_info const *)(1+ li)); // &b_info xi.size = sz_compressed - (sizeof(struct l_info) + sizeof(struct p_info)); xo.buf = (char *)mhdr; - xo.size = ((struct b_info const *)xi.buf)->sz_unc; + xo.size = ((struct b_info const *)(void const *)xi.buf)->sz_unc; xi0 = xi; // Uncompress Macho headers @@ -417,9 +417,9 @@ upx_main( unsigned j; for (j=0; j < mhdr->ncmds; ++j, - (lc = (Mach_load_command const *)(lc->cmdsize + (char const *)lc)) + (lc = (Mach_load_command const *)(void const *)(lc->cmdsize + (char const *)lc)) ) if (LC_LOAD_DYLINKER==lc->cmd) { - char const *const dyld_name = ((Mach_lc_str const *)(1+ lc))->offset + + char const *const dyld_name = ((Mach_lc_str const *)(void const *)(1+ lc))->offset + (char const *)lc; int const fdi = open(dyld_name, O_RDONLY, 0); if (0 > fdi) { diff --git a/src/stub/src/ppc64le-linux.elf-main.c b/src/stub/src/ppc64le-linux.elf-main.c index f7899aec..b08e4c99 100644 --- a/src/stub/src/ppc64le-linux.elf-main.c +++ b/src/stub/src/ppc64le-linux.elf-main.c @@ -233,7 +233,7 @@ do_xmap( f_unfilter *const f_unf ) { - Elf64_Phdr const *phdr = (Elf64_Phdr const *) (ehdr->e_phoff + + Elf64_Phdr const *phdr = (Elf64_Phdr const *) (void const *) (ehdr->e_phoff + (char const *)ehdr); char *v_brk; unsigned long const reloc = xfind_pages( @@ -269,8 +269,8 @@ do_xmap( //} frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary /* if (! (PROT_WRITE & prot)) { - bzero(mlen+addr, frag); // fragment at hi end - } */ + bzero(mlen+addr, frag); // fragment at hi end + } */ if (xi) { if (0!=mprotect(addr, mlen, prot)) { err_exit(10); @@ -310,7 +310,7 @@ void *upx_main( xi.buf = CONST_CAST(char *, 1+ (struct p_info const *)(1+ li)); // &b_info xi.size = sz_compressed - (sizeof(struct l_info) + sizeof(struct p_info)); xo.buf = (char *)ehdr; - xo.size = ((struct b_info const *)xi.buf)->sz_unc; + xo.size = ((struct b_info const *)(void const *)xi.buf)->sz_unc; xi0 = xi; ACC_UNUSED(sz_ehdr);