diff --git a/src/stub/Makefile b/src/stub/Makefile index 72c63002..553d346c 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -284,8 +284,9 @@ endef define tc.default.f-embed_objinfo_without_xstrip chmod a-x $1 - $(call tc,objcopy) -R .text -R .data -R .bss $1 - $(call tc,objcopy) -R .comment -R .note -R .note.GNU-stack -R .reginfo $1 + $(call tc,objcopy) -R .text -R .data -R .bss \ + -R .comment -R .note -R .note.GNU-stack -R .reginfo \ + -R .mdebug.eabi32 -R .gcc_compiled_long32 $1 $(call tc,objcopy) --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main $1 # # Disassemble for human readability @@ -1554,49 +1555,52 @@ tc.mips.r3000-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables tc.mips.r3000-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror mips.r3000-linux.elf-entry.h : $(srcdir)/src/mips.r3000-linux.elf-entry.lds \ - $(srcdir)/src/$$T.S + $(srcdir)/src/$$T.S \ + tmp/mips.r3000-linux.elf-upxfd_linux.s @echo; echo TARGET: $@; echo - # info: we really need as-2.17 here; as-2.16.1 as used by gcc-4.1.1 does _not_ work - $(call tc,gcc) -E -x assembler-with-cpp \ - -D__mips__ -D__MIPSEB__ -D_TARGET_LINUX_ $(srcdir)/src/$T.S \ - | $(call tc,pp-as) -achlmms=tmp/$T.list -o tmp/$T.o + mipsel-linux-gcc-4.1.1 -E -D__mips__ -D__MIPSEB__ -D_TARGET_LINUX_ $(srcdir)/src/$T.S \ + | cat - tmp/mips.r3000-linux.elf-upxfd_linux.s \ + | mipsel-elf-as-20060406 -EB -O -mno-pdr -o tmp/mips.r3000-linux.elf-entry.o $(call tc,gpp_mkdep) --mode=c --MMD=$@ --MF=tmp/$T.d $(srcdir)/src/$T.S multiarch-ld-2.17 -r --format=elf32-bigmips -Map tmp/$T.map -o tmp/$T.bin \ - -T src/mips.r3000-linux.elf-entry.lds \ - tmp/$T.o + -T src/mips.r3000-linux.elf-entry.lds \ + tmp/mips.r3000-linux.elf-entry.o $(call tc,f-embed_objinfo_without_xstrip,tmp/$T.bin) $(call tc,bin2h) tmp/$T.bin $@ -tmp/mips.r3000-linux.elf-upxfd_android.o : $(srcdir)/src/upxfd_android.c +tmp/mips.r3000-linux.elf-upxfd_linux.s : $(srcdir)/src/upxfd_linux.c @echo; echo TARGET: $@; echo - $(call tc,gcc) -c -O $< -o $@ - $(call tc,objcopy) --rename-section .text=UMF_ANDROID -R .comment -R .data -R .bss -R .note.GNU-stack $@ - $(call tc,objdump) -Dr $(tc_objdump_disasm_options) $@ | $(RTRIM) > $@.disasm - -tmp/mips.r3000-linux.elf-upxfd_linux.o : $(srcdir)/src/upxfd_linux.c - @echo; echo TARGET: $@; echo - $(call tc,gcc) -c -O $< -o $@ - $(call tc,objcopy) --rename-section .text=UMF_LINUX -R .comment -R .data -R .bss -R .note.GNU-stack $@ - $(call tc,objdump) -Dr $(tc_objdump_disasm_options) $@ | $(RTRIM) > $@.disasm + cp $< tmp/mips.r3000-linux.elf-upxfd_linux.c + ( cd tmp; \ + mipsel-linux-gcc-4.1.1 -meb -march=r3000 -mno-abicalls -mabi=eabi -G0 -nostdinc -MMD \ + -fno-exceptions -fno-asynchronous-unwind-tables \ + -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror \ + -I../src -S -O mips.r3000-linux.elf-upxfd_linux.c; \ + sed < mips.r3000-linux.elf-upxfd_linux.s > mips.r3000-linux.elf-upxfd_linux.ii \ + -e 's/^\t\.text/ section UMF_LINUX/' \ + -e 's/ j[ ][ ]*$$L/ b $$L/' \ + -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' ; \ + mv mips.r3000-linux.elf-upxfd_linux.ii mips.r3000-linux.elf-upxfd_linux.s \ + ) mips.r3000-linux.elf-fold.h : $(srcdir)/src/$$T.lds \ $(srcdir)/src/$$T.S \ tmp/mips.r3000-linux.elf-main2.s \ - tmp/mips.r3000-linux.upxfd_linux.s \ + tmp/mips.r3000-linux.elf-upxfd_linux.s \ src/mips.r3000-expand.S @echo; echo TARGET: $@; echo cat > tmp/mips.r3000-linux.elf-fold-2.S \ src/mips.r3000-linux.elf-fold.S \ tmp/mips.r3000-linux.elf-main2.s \ - tmp/mips.r3000-linux.upxfd_linux.s \ + tmp/mips.r3000-linux.elf-upxfd_linux.s \ src/mips.r3000-expand.S (cd tmp; ln -sf ../src/arch arch) $(call tc,gcc) -E \ -D__mips__ -D__MIPSEB__ -D_TARGET_LINUX_ \ - tmp/mips.r3000-linux.elf-fold-2.S \ + tmp/mips.r3000-linux.elf-fold-2.S \ | sed -e $$(cat src/dollar-dollar.sed) > tmp/mips.r3000-linux.elf-fold-3.S # info: as-2.16.1 as used by gcc-4.1.1 does _not_ work` - $(call tc,as) -EB tmp/mips.r3000-linux.elf-fold-3.S -march=r3000 -o tmp/$T.o + $(call tc,as) -EB -march=r3000 tmp/mips.r3000-linux.elf-fold-3.S -o tmp/$T.o $(call tc,objdump) -Dr $(tc_objdump_disasm_options) tmp/$T.o > tmp/$@.disasm $(call tc,gpp_mkdep) --mode=c --MMD=$@ --MF=tmp/$T.d $(srcdir)/src/$T.S $(call tc,ld) -r -T $(srcdir)/src/$T.lds -Map tmp/$T.map -o tmp/$T.bin \ @@ -1605,46 +1609,26 @@ mips.r3000-linux.elf-fold.h : $(srcdir)/src/$$T.lds \ # "unrecognized program segment header size" $(call tc,sstrip) tmp/$T.bin $(call tc,bin2h) tmp/$T.bin $@ -tmp/mips.r3000-linux.upxfd_android.s: $(srcdir)/src/upxfd_android.c +tmp/mips.r3000-linux.elf-main2.s: $(srcdir)/src/i386-linux.elf-main2.c @echo; echo TARGET: $@; echo - $(call tc,gcc) -S -D__mips__ \ - -D_TARGET_LINUX_ -DNO_WANT_MMAP -O $< -o - \ - | sed -e '/^\t\.file\t/d' \ - -e 's/L[0-9][0-9]*/L8&/g' \ - -e $$(cat src/dollar-dollar.sed) \ - -e 's/ j[ ][ ]*$$L/ b $$L/' \ - -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' \ - >$@ - -tmp/mips.r3000-linux.upxfd_linux.s: $(srcdir)/src/upxfd_linux.c - @echo; echo TARGET: $@; echo - $(call tc,gcc) -S -D__mips__ \ - -D_TARGET_LINUX_ -DNO_WANT_MMAP -O $< -o - \ - | sed -e '/^\t\.file\t/d' \ - -e '/^\t*\.text/s//.section UMF_LINUX/' \ - -e 's/L[0-9][0-9]*/L9&/g' \ - -e $$(cat src/dollar-dollar.sed) \ - -e 's/ j[ ][ ]*$$L/ b $$L/' \ - -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' \ - >$@ - -tmp/mips.r3000-linux.elf-main2.s: $(srcdir)/src/$$T.c $(srcdir)/src/i386-linux.elf-main2.c - @echo; echo TARGET: $@; echo - $(call tc,gcc) -S -D__mips__ -D_TARGET_LINUX_ -O $< -o - \ - | sed -e '/^\t\.file\t/d' \ - -e 's/L[0-9][0-9]*/L7&/g' \ - -e $$(cat src/dollar-dollar.sed) \ - -e 's/ j[ ][ ]*$$L/ b $$L/' \ - -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' \ - >$@ - -tmp/mips.r3000-linux.elf-main2.o : $(srcdir)/src/$$T.c $(srcdir)/src/i386-linux.elf-main2.c - @echo; echo TARGET: $@; echo - $(call tc,gcc) -S -Os -MF tmp/$T.d $< -o - | $(RTRIM) > tmp/$T.i - sed -e 's/ j[ ][ ]*$$L/ b $$L/' \ - -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' < tmp/$T.i > tmp/$T.s - $(call tc,gcc) -c -Wa,-O,-mno-pdr tmp/$T.s -o $@ - $(call tc,f-objstrip,$@) + cp $< tmp/mips.r3000-linux.elf-main2.c + ( cd tmp; \ + mipsel-linux-gcc-4.1.1 -meb -march=r3000 -mno-abicalls -mabi=eabi -G0 -nostdinc -MMD \ + -fno-exceptions -fno-asynchronous-unwind-tables \ + -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror \ + -D__mips__ -D__MIPS__ -D_TARGET_LINUX_ \ + -I../src -S -O mips.r3000-linux.elf-main2.c; \ + sed < mips.r3000-linux.elf-main2.s > mips.r3000-linux.elf-main2.ii \ + -e '/section .gcc_compiled/d' \ + -e '/section .mdebug.eabi/d' \ + -e '/^\t\.file\t/d' \ + -e 's/L[0-9][0-9]*/L7&/g' \ + -e $$(cat ../src/dollar-dollar.sed) \ + -e 's/ j[ ][ ]*$$L/ b $$L/' \ + -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' \ + ; \ + mv mips.r3000-linux.elf-main2.ii mips.r3000-linux.elf-main2.s \ + ) # /*********************************************************************** @@ -1673,41 +1657,61 @@ endif # // mipsel.r3000-linux.elf # ************************************************************************/ -tc.mipsel.r3000-linux.elf.as = mipsel-elf-as-20060406 -EL -O -mno-pdr -tc.mipsel.r3000-linux.elf.pp-as= mipsel-elf-as-20060406 -EL -mabi=eabi -Wall -tc.mipsel.r3000-linux.elf.gcc = mipsel-linux-gcc-4.1.1 -mel -march=r3000 -mno-abicalls -mabi=eabi -G0 -nostdinc -MMD -MT $@ -tc.mipsel.r3000-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables -tc.mipsel.r3000-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror - mipsel.r3000-linux.elf%.h : tc_list = mipsel.r3000-ps1 default mipsel.r3000-linux.elf%.h : tc_bfdname = elf32-littlemips +tc.mipsel.r3000-linux.elf.as = mipsel-elf-as-20060406 -EL -O -mno-pdr \ + -D__mips__ -D__MIPSEL__ -D_TARGET_LINUX_ +tc.mipsel.r3000-linux.elf.pp-as= mipsel-elf-as-20060406 -EL -mabi=eabi -Wall -mno-pdr +tc.mipsel.r3000-linux.elf.gcc = mipsel-linux-gcc-4.1.1 -mel -D__MIPS__ -D__MIPSEL__ -D_TARGET_LINUX_ \ + -march=r3000 -mno-abicalls -mabi=eabi -G0 -nostdinc -MMD -MT $@ +tc.mipsel.r3000-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables +tc.mipsel.r3000-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror + mipsel.r3000-linux.elf-entry.h : $(srcdir)/src/mipsel.r3000-linux.elf-entry.lds \ - $(srcdir)/src/$$T.S + $(srcdir)/src/$$T.S \ + tmp/mipsel.r3000-linux.elf-upxfd_linux.s @echo; echo TARGET: $@; echo - # info: we really need as-2.17 here; as-2.16.1 as used by gcc-4.1.1 does _not_ work - $(call tc,pp-as) -E -x assembler-with-cpp \ - -D__mips__ -D__MIPSEL__ -D_TARGET_LINUX_ $(srcdir)/src/$T.S \ - | mipsel-elf-as-20060406 -EL -mabi=eabi -Wall -a=/dev/null -o tmp/$T.o + mipsel-linux-gcc-4.1.1 -E -mel -march=r3000 -mno-abicalls -mabi=eabi -G0 -nostdinc -MMD \ + -D__mipsel__ -D__MIPSEL__ -D_TARGET_LINUX_ $(srcdir)/src/$T.S \ + | cat - tmp/mipsel.r3000-linux.elf-upxfd_linux.s \ + | mipsel-elf-as-20060406 -EL -O -mno-pdr -o tmp/mipsel.r3000-linux.elf-entry.o $(call tc,gpp_mkdep) --mode=c --MMD=$@ --MF=tmp/$T.d $(srcdir)/src/$T.S multiarch-ld-2.17 -r --format=elf32-littlemips -Map tmp/$T.map -o tmp/$T.bin \ - -T src/mipsel.r3000-linux.elf-entry.lds \ - tmp/$T.o + -T src/mipsel.r3000-linux.elf-entry.lds \ + tmp/mipsel.r3000-linux.elf-entry.o $(call tc,f-embed_objinfo_without_xstrip,tmp/$T.bin) $(call tc,bin2h) tmp/$T.bin $@ +tmp/mipsel.r3000-linux.elf-upxfd_linux.s : $(srcdir)/src/upxfd_linux.c + @echo; echo TARGET: $@; echo + cp $< tmp/mipsel.r3000-linux.elf-upxfd_linux.c + ( cd tmp; \ + mipsel-linux-gcc-4.1.1 -mel -march=r3000 -mno-abicalls -mabi=eabi -G0 -nostdinc -MMD \ + -fno-exceptions -fno-asynchronous-unwind-tables \ + -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror \ + -D__mips__ -D__MIPS__ -D__MIPSEL__ -D_TARGET_LINUX_\ + -I../src -S -O mipsel.r3000-linux.elf-upxfd_linux.c; \ + sed < mipsel.r3000-linux.elf-upxfd_linux.s > mipsel.r3000-linux.elf-upxfd_linux.ii \ + -e '/section .gcc_compiled/d' \ + -e '/section .mdebug.eabi/d' \ + -e '/^\t\.file\t/d' \ + -e 's/^\t\.text/ section UMF_LINUX/' \ + -e 's/ j[ ][ ]*$$L/ b $$L/' \ + -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' ; \ + mv mipsel.r3000-linux.elf-upxfd_linux.ii mipsel.r3000-linux.elf-upxfd_linux.s \ + ) + mipsel.r3000-linux.elf-fold.h : $(srcdir)/src/$$T.lds \ $(srcdir)/src/$$T.S \ tmp/mipsel.r3000-linux.elf-main2.s \ - tmp/mipsel.r3000-linux.upxfd_android.s \ - tmp/mipsel.r3000-linux.upxfd_linux.s \ + tmp/mipsel.r3000-linux.elf-upxfd_linux.s \ src/mipsel.r3000-expand.S @echo; echo TARGET: $@; echo cat > tmp/mipsel.r3000-linux.elf-fold-2.S \ src/mipsel.r3000-linux.elf-fold.S \ tmp/mipsel.r3000-linux.elf-main2.s \ - tmp/mipsel.r3000-linux.upxfd_android.s \ - tmp/mipsel.r3000-linux.upxfd_linux.s \ + tmp/mipsel.r3000-linux.elf-upxfd_linux.s \ src/mipsel.r3000-expand.S (cd tmp; ln -sf ../src/arch arch) $(call tc,gcc) -E \ @@ -1715,57 +1719,27 @@ mipsel.r3000-linux.elf-fold.h : $(srcdir)/src/$$T.lds \ tmp/mipsel.r3000-linux.elf-fold-2.S \ | sed -e $$(cat src/dollar-dollar.sed) > tmp/mipsel.r3000-linux.elf-fold-3.S # info: as-2.16.1 as used by gcc-4.1.1 does _not_ work` - $(call tc,as) -EL tmp/mipsel.r3000-linux.elf-fold-3.S -march=r3000 -o tmp/$T.o + $(call tc,as) -EL -march=r3000 tmp/mipsel.r3000-linux.elf-fold-3.S -o tmp/$T.o $(call tc,objdump) -Dr $(tc_objdump_disasm_options) tmp/$T.o > tmp/$@.disasm - $(call tc,gpp_mkdep) --mode=c --MMD=$@ --MF=tmp/$T.d $< + $(call tc,gpp_mkdep) --mode=c --MMD=$@ --MF=tmp/$T.d $(srcdir)/src/$T.S $(call tc,ld) -r -T $(srcdir)/src/$T.lds -Map tmp/$T.map -o tmp/$T.bin \ tmp/$T.o $(call tc,f-embed_objinfo_without_xstrip_keep_dot_text,tmp/$T.bin) # "unrecognized program segment header size" $(call tc,sstrip) tmp/$T.bin $(call tc,bin2h) tmp/$T.bin $@ -tmp/mipsel.r3000-linux.upxfd_android.s: $(srcdir)/src/upxfd_android.c - @echo; echo TARGET: $@; echo - $(call tc,gcc) -S -D__mipsel__ \ - -D_TARGET_LINUX_ -DNO_WANT_MMAP -O $< -o - \ - | sed -e '/^\t\.file\t/d' \ - -e 's/L[0-9]*/L8&/g' \ - -e $$(cat src/dollar-dollar.sed) \ - -e 's/ j[ ][ ]*$$L/ b $$L/' \ - -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' \ - >$@ - -tmp/mipsel.r3000-linux.upxfd_linux.s: $(srcdir)/src/upxfd_linux.c - @echo; echo TARGET: $@; echo - $(call tc,gcc) -S -D__mipsel__ \ - -D_TARGET_LINUX_ -DNO_WANT_MMAP -O $< -o - \ - | tee foo-mipsel.r3000-linux.upxfd_linux.s \ - | sed -e '/^\t\.file\t/d' \ - -e '/^\t*\.text/s//.section UMF_LINUX/' \ - -e 's/L[0-9][0-9]*/L9&/g' \ - -e $$(cat src/dollar-dollar.sed) \ - -e 's/ j[ ][ ]*$$L/ b $$L/' \ - -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' \ - >$@ - tmp/mipsel.r3000-linux.elf-main2.s: $(srcdir)/src/$$T.c $(srcdir)/src/i386-linux.elf-main2.c @echo; echo TARGET: $@; echo $(call tc,gcc) -S -D__mipsel__ -D_TARGET_LINUX_ -O $< -o - \ - | sed -e '/^\t\.file\t/d' \ - -e 's/L[0-9]*/L7&/g' \ + | sed -e '/section .gcc_compiled/d' \ + -e '/section .mdebug.eabi/d' \ + -e '/^\t\.file\t/d' \ + -e 's/L[0-9][0-9]*/L7&/g' \ -e $$(cat src/dollar-dollar.sed) \ -e 's/ j[ ][ ]*$$L/ b $$L/' \ -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' \ >$@ -tmp/mipsel.r3000-linux.elf-main2.o : $(srcdir)/src/$$T.c $(srcdir)/src/i386-linux.elf-main2.c - @echo; echo TARGET: $@; echo - $(call tc,gcc) -S -Os -MF tmp/$T.d $< -o - | $(RTRIM) > tmp/$T.i - sed -e 's/ j[ ][ ]*$$L/ b $$L/' \ - -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' < tmp/$T.i > tmp/$T.s - $(call tc,gcc) -c -Wa,-O,-mno-pdr tmp/$T.s -o $@ - $(call tc,f-objstrip,$@) - # /*********************************************************************** # // mipsel.r3000-linux.shlib @@ -2027,7 +2001,7 @@ powerpc64le-linux.elf-fold.h : $(srcdir)/src/$$T.lds \ tmp/powerpc64le-linux.elf-main2.s: $(srcdir)/src/$$T.c $(srcdir)/src/amd64-linux.elf-main2.c $(call tc,gcc) -S -O $< -o - \ | sed -e '/^\t\.file\t/d' \ - -e 's/L[0-9]*/L7&/g' \ + -e 's/L[0-9][0-9]*/L7&/g' \ -e $$(cat src/dollar-dollar.sed) \ -e 's/ j[ ][ ]*$$L/ b $$L/' \ -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' \ @@ -2083,7 +2057,7 @@ powerpc64-linux.elf-fold.h : $(srcdir)/src/$$T.lds \ tmp/powerpc64-linux.elf-main2.s: $(srcdir)/src/$$T.c $(srcdir)/src/amd64-linux.elf-main2.c $(call tc,gcc) -S -O $< -o - \ | sed -e '/^\t\.file\t/d' \ - -e 's/L[0-9]*/L7&/g' \ + -e 's/L[0-9][0-9]*/L7&/g' \ -e $$(cat src/dollar-dollar.sed) \ -e 's/ j[ ][ ]*$$L/ b $$L/' \ -e 's/ jal[ ][ ]*\([^\$$]\)/ bal \1/' \