diff --git a/src/stub/Makefile b/src/stub/Makefile index 21ef8704..7fa9707b 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -134,14 +134,14 @@ tc.default.m-objdump = multiarch-objdump-2.17 $(if $(tc_bfdname),-b $(tc_bfdnam tc.default.m-ld = multiarch-ld-2.17 $(if $(tc_bfdname),-b $(tc_bfdname)) tc.default.m-nm = multiarch-nm-2.17 $(if $(tc_bfdname),--target=$(tc_bfdname)) tc.default.m-readelf = multiarch-readelf-2.17 -tc.default.nasm = nasm -tc.default.nasm += -I$(srcdir)/ -I$(srcdir)/src/ -tc.default.nasm += -O99 -w+macro-params -w+macro-selfref -w+number-overflow -w+orphan-labels -tc.default.nasm += -Dstub_$(subst .,_,$(subst -,_,$(basename $(notdir $@))))=1 +##tc.default.nasm = nasm +##tc.default.nasm += -I$(srcdir)/ -I$(srcdir)/src/ +##tc.default.nasm += -O99 -w+macro-params -w+macro-selfref -w+number-overflow -w+orphan-labels +##tc.default.nasm += -Dstub_$(subst .,_,$(subst -,_,$(basename $(notdir $@))))=1 tc.default.o2bin = perl $(top_srcdir)/src/stub/scripts/o2bin.pl ##tc.default.pp-asm = i386-linux-gcc-2.95.3 -E -nostdinc -x assembler-with-cpp -Wall -Wp,-P,-C,-traditional tc.default.pp-asm = i386-linux-gcc-3.4.6 -E -nostdinc -x assembler-with-cpp -Wall -tc.default.pp-nasm = $(tc.default.gpp_inc) --mode=nasm -I$(srcdir)/ -I$(srcdir)/src/ +##tc.default.pp-nasm = $(tc.default.gpp_inc) --mode=nasm -I$(srcdir)/ -I$(srcdir)/src/ tc.default.sstrip = sstrip # some common settings for $(tc_list) @@ -522,8 +522,8 @@ tmp/i386-linux.elf.execve-main.o : $(srcdir)/src/$$T.c $(call tc,gcc) -c $< -o $@ $(call tc,objstrip) $@ -tmp/i386-linux.elf.execve-upx_itoa.o: $(srcdir)/src/$$T.asm - $(call tc,nasm) -f elf -l $@.lst $< -o $@ +tmp/i386-linux.elf.execve-upx_itoa.o: $(srcdir)/src/$$T.S + $(call tc,gcc) -c -x assembler-with-cpp $< -o $@ $(call tc,objstrip) $@ diff --git a/src/stub/src/arch/i386/upx_itoa.S b/src/stub/src/arch/i386/upx_itoa.S new file mode 100644 index 00000000..ecf28055 --- /dev/null +++ b/src/stub/src/arch/i386/upx_itoa.S @@ -0,0 +1,57 @@ +/* +; upx_itoa.asm -- decimal print; smaller than gcc, and no relocations +; +; This file is part of the UPX executable compressor. +; +; Copyright (C) 2002-2006 John F. Reiser +; All Rights Reserved. +; +; UPX and the UCL library are free software; you can redistribute them +; and/or modify them under the terms of the GNU General Public License as +; published by the Free Software Foundation; either version 2 of +; the License, or (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program; see the file COPYING. +; If not, write to the Free Software Foundation, Inc., +; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +; +; John F. Reiser +; +; +*/ + + + .globl upx_itoa + +upx_itoa: // char *upx_itoa(eax= unsigned v, edx= char *buf) /* 0<=(int)v */ + push edi // save register + mov edi,edx // output ptr + push 10 + cld + pop ecx // radix + call recur + mov [edi],ah // NUL terminate + xchg eax,edi // eax= continuation point + pop edi // restore register + ret +recur: + cdq // zero extend eax into edx [use "sub edx,edx" if eax < 0 ] + div ecx // eax=quo, edx=rem; flags are undefined + push edx + test eax,eax + je quo0 + call recur +quo0: + pop eax // remainder + add al, '0' + stosb + ret + + +// vi:ts=8:et:nowrap diff --git a/src/stub/src/i386-linux.elf.execve-upx_itoa.S b/src/stub/src/i386-linux.elf.execve-upx_itoa.S new file mode 100644 index 00000000..30ad394c --- /dev/null +++ b/src/stub/src/i386-linux.elf.execve-upx_itoa.S @@ -0,0 +1,2 @@ +#include "arch/i386/macros2.ash" +#include "arch/i386/upx_itoa.S" diff --git a/src/stub/src/i386-linux.elf.execve-upx_itoa.asm b/src/stub/src/i386-linux.elf.execve-upx_itoa.asm deleted file mode 100644 index 2eb8950b..00000000 --- a/src/stub/src/i386-linux.elf.execve-upx_itoa.asm +++ /dev/null @@ -1 +0,0 @@ -%include "arch/i386/upx_itoa.ash"