mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
merge
This commit is contained in:
commit
afae9b8d17
|
@ -134,21 +134,13 @@ 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.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-as = i386-linux-gcc-3.4.6 -E -nostdinc -x assembler-with-cpp -Wall
|
||||
tc.default.sstrip = sstrip
|
||||
|
||||
# some common settings for $(tc_list)
|
||||
##tc.arch-i086.app-nasm = perl -w $(srcdir)/src/arch/i086/app-nasm.pl
|
||||
tc.arch-i086.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD
|
||||
##tc.arch-i386.app-nasm = perl -w $(srcdir)/src/arch/i386/app-nasm.pl
|
||||
tc.arch-i386.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD
|
||||
tc.arch-i086.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD
|
||||
tc.arch-i386.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD
|
||||
|
||||
|
||||
# slightly tricky make stuff follows
|
||||
|
@ -218,7 +210,6 @@ tmp/amd64-linux.elf-main.o : $(srcdir)/src/$$T.c
|
|||
arm-linux.elf% : tc_list = arm-linux.elf default
|
||||
arm-linux.elf% : tc_bfdname = elf32-littlearm
|
||||
|
||||
#tc.arm-linux.elf.gcc = arm-9tdmi-linux-gnu-gcc-3.4.5 -march=armv4 -nostdinc -MMD
|
||||
tc.arm-linux.elf.gcc = arm-linux-gcc-4.1.0 -march=armv4 -nostdinc -MMD
|
||||
tc.arm-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||
tc.arm-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||
|
@ -363,6 +354,7 @@ tmp/i386-bsd.elf-main.o : $(srcdir)/src/$$T.c
|
|||
$(call tc,gcc) -c $< -o $@
|
||||
$(call tc,objstrip) $@
|
||||
|
||||
|
||||
i386-openbsd.elf% : tc_list = i386-openbsd.elf arch-i386 default
|
||||
i386-openbsd.elf% : tc_bfdname = elf32-i386
|
||||
|
||||
|
@ -626,18 +618,13 @@ i386-win32.pe.h : $(srcdir)/src/$$T.asm
|
|||
m68k-atari.tos-%.h : tc_list = m68k-atari.tos default
|
||||
m68k-atari.tos-%.h : tc_bfdname = elf32-m68k
|
||||
|
||||
##tc.m68k-atari.tos.app-a68k = perl -w $(srcdir)/src/arch/m68k/app-a68k.pl
|
||||
##tc.m68k-atari.tos.asm-a68k = a68k
|
||||
##tc.m68k-atari.tos.pp-asm = gcc -E -nostdinc -x assembler-with-cpp -Wall
|
||||
tc.m68k-atari.tos.asm-gas = m68k-linux-as-20060406 --register-prefix-optional
|
||||
tc.m68k-atari.tos.asm-as = m68k-linux-as-20060406 --register-prefix-optional
|
||||
|
||||
m68k-atari.tos-nrv%.h : $(srcdir)/src/m68k-atari.tos.asm
|
||||
# call gpp_inc to generate .d file
|
||||
$(call tc,gpp_inc) --mode=c --MMD=$@ --MF=tmp/$T.i.d $< -o /dev/null
|
||||
$(call tc,pp-asm) -D__GAS__ $(PP_FLAGS) $< -o tmp/$T.i
|
||||
## $(call tc,asm-a68k) -q -ltmp/$T.o.lst tmp/$T.i -otmp/$T.o
|
||||
$(call tc,asm-gas) tmp/$T.i -o tmp/$T.bin
|
||||
## $(call tc,o2bin) tmp/$T.o tmp/$T.bin 'UPX1' 'UPX9'
|
||||
$(call tc,pp-as) -D__GAS__ $(PP_FLAGS) $< -o tmp/$T.i
|
||||
$(call tc,asm-as) tmp/$T.i -o tmp/$T.bin
|
||||
$(call tc,m-objcopy) --strip-unneeded tmp/$T.bin
|
||||
$(call tc,m-objcopy) -R .text -R .data -R .bss tmp/$T.bin
|
||||
$(call tc,m-objcopy) -R .note -R .comment tmp/$T.bin
|
||||
|
@ -661,14 +648,12 @@ m68k-atari.tos-nrv2%.small.h : IDENT_SUFFIX = _small
|
|||
mipsel.r3000-ps1.h : tc_list = mipsel.r3000-ps1 default
|
||||
mipsel.r3000-ps1.h : tc_bfdname = elf32-littlemips
|
||||
|
||||
tc.mipsel.r3000-ps1.as = mipsel-elf-as-20060406 -O2 -mno-pdr
|
||||
##tc.mipsel.r3000-ps1.pp-asm = gcc -E -nostdinc -x assembler-with-cpp -Wall
|
||||
tc.mipsel.r3000-ps1.gcc = mipsel-elf-gcc
|
||||
tc.mipsel.r3000-ps1.as = mipsel-elf-as-20060406 -O2 -mno-pdr
|
||||
|
||||
mipsel.r3000-ps1.h : $(srcdir)/src/mipsel.r3000-ps1.asm
|
||||
mipsel.r3000-ps1.h : $(srcdir)/src/$$T.asm
|
||||
# call gpp_inc to generate .d file
|
||||
$(call tc,gpp_inc) --mode=c --MMD=$@ --MF=tmp/$T.tmp1.d $< -o /dev/null
|
||||
$(call tc,pp-asm) $(PP_FLAGS) $< -o tmp/$T.tmp1
|
||||
$(call tc,pp-as) $(PP_FLAGS) $< -o tmp/$T.tmp1
|
||||
$(call tc,as) tmp/$T.tmp1 -o tmp/$T.bin
|
||||
$(call tc,m-objcopy) --strip-unneeded tmp/$T.bin
|
||||
$(call tc,m-objcopy) -R .text -R .data -R .bss tmp/$T.bin
|
||||
|
@ -677,8 +662,8 @@ mipsel.r3000-ps1.h : $(srcdir)/src/mipsel.r3000-ps1.asm
|
|||
$(call tc,m-objdump) -trwh tmp/$T.bin >> tmp/$T.bin
|
||||
$(call tc,bin2h) --ident=$(IDENT_NAME) tmp/$T.bin $@
|
||||
|
||||
mipsel.r3000-ps1.h: PP_FLAGS += -DPS1
|
||||
mipsel.r3000-ps1.h: IDENT_NAME = nrv_loader
|
||||
mipsel.r3000-ps1.h: PP_FLAGS += -DPS1
|
||||
mipsel.r3000-ps1.h: IDENT_NAME = nrv_loader
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# app_i386.pl -- assembly preprocessor for upx
|
||||
#
|
||||
# This file is part of the UPX executable compressor.
|
||||
#
|
||||
# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
||||
# Copyright (C) 1996-2006 Laszlo Molnar
|
||||
# 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.
|
||||
#
|
||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
# <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||
#
|
||||
|
||||
#
|
||||
# usage: app.pl infile outfile
|
||||
#
|
||||
|
||||
$in = shift || die;
|
||||
$ou = shift || die;
|
||||
|
||||
open (IN,"<$in") or die;
|
||||
open (OU,">$ou") or die;
|
||||
binmode IN;
|
||||
binmode OU;
|
||||
|
||||
@lines = <IN>;
|
||||
|
||||
%labels = ();
|
||||
$i = 0;
|
||||
$cs = "";
|
||||
|
||||
($ilabel = $in) =~ s,^.*[\/\\],,; # get basename
|
||||
$ilabel =~ s/\W//g;
|
||||
|
||||
# 1st pass
|
||||
for $line (@lines)
|
||||
{
|
||||
$labels{$1} = "$cs" if ($line =~ /^(\w+):/ && $cs);
|
||||
if ($line =~ /__([A-Z][A-Z0-9_]+)__/) {
|
||||
$cs = $1;
|
||||
# verify the line
|
||||
if ($line =~ /^[\%\;]ifdef/) {
|
||||
# ok
|
||||
} elsif ($line =~ /^([\%\;]\w+)?\s*;/) {
|
||||
# ok
|
||||
} else {
|
||||
print STDERR "$in:$i:warning 1:$line"
|
||||
}
|
||||
}
|
||||
|
||||
if ($line =~ /^[\%\;](if|el|endi)/)
|
||||
{
|
||||
if ($line =~ /__([A-Z][A-Z0-9_]+)__/)
|
||||
{
|
||||
$line=";$line" unless ($line =~ /^\;/);
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "$in:$i:warning 2:$line";
|
||||
}
|
||||
}
|
||||
$line =~ s/\.ash/\.asy/ if ($line =~ /^\s*\%include/);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$cs = "";
|
||||
$i = 0;
|
||||
|
||||
# 2nd pass
|
||||
for $line (@lines)
|
||||
{
|
||||
if ($line =~ /^\s+(j\w+|loop|call)\s+(\w*)/)
|
||||
{
|
||||
$label = $2;
|
||||
die "$line" if ($label =~ /(\bnear\b|\bshort\b)/);
|
||||
if (defined $labels{$label})
|
||||
{
|
||||
$ts = $labels{$label};
|
||||
if ($ts ne $cs)
|
||||
{
|
||||
$line =~ s/$label/J$i$ilabel/;
|
||||
print OU $line;
|
||||
print OU "J$i$ilabel:\n";
|
||||
print OU "\t\tsection\t.data\n\t\tdd\t";
|
||||
print OU "0,J$i$ilabel\n\t\tdb\t\'$ts\',0\n\t\tdd\t$label - S$ts$ilabel\n";
|
||||
print OU "\t\tsection\t.text\n\n";
|
||||
$line = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$line = ";$line" if ($line =~ /^\s+align\s/);
|
||||
|
||||
print OU $line;
|
||||
if ($line =~ /__([A-Z][A-Z0-9_]+)__/)
|
||||
{
|
||||
print OU "S$1$ilabel:\n";
|
||||
print OU "\t\tsection\t.data\n\t\tdb\t\'$1\',0\n\t\tdd\tS$1$ilabel\n";
|
||||
print OU "\t\tsection\t.text\n\n";
|
||||
$cs = $1;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
# vi:ts=4:et
|
|
@ -1,121 +0,0 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# app_i386.pl -- assembly preprocessor for upx
|
||||
#
|
||||
# This file is part of the UPX executable compressor.
|
||||
#
|
||||
# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
||||
# Copyright (C) 1996-2006 Laszlo Molnar
|
||||
# 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.
|
||||
#
|
||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
# <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||
#
|
||||
|
||||
#
|
||||
# usage: app.pl infile outfile
|
||||
#
|
||||
|
||||
$in = shift || die;
|
||||
$ou = shift || die;
|
||||
|
||||
open (IN,"<$in") or die;
|
||||
open (OU,">$ou") or die;
|
||||
binmode IN;
|
||||
binmode OU;
|
||||
|
||||
@lines = <IN>;
|
||||
|
||||
%labels = ();
|
||||
$i = 0;
|
||||
$cs = "";
|
||||
|
||||
($ilabel = $in) =~ s,^.*[\/\\],,; # get basename
|
||||
$ilabel =~ s/\W//g;
|
||||
|
||||
# 1st pass
|
||||
for $line (@lines)
|
||||
{
|
||||
$labels{$1} = "$cs" if ($line =~ /^(\w+):/ && $cs);
|
||||
if ($line =~ /__([A-Z][A-Z0-9_]+)__/) {
|
||||
$cs = $1;
|
||||
# verify the line
|
||||
if ($line =~ /^[\%\;]ifdef/) {
|
||||
# ok
|
||||
} elsif ($line =~ /^([\%\;]\w+)?\s*;/) {
|
||||
# ok
|
||||
} else {
|
||||
print STDERR "$in:$i:warning 1:$line"
|
||||
}
|
||||
}
|
||||
|
||||
if ($line =~ /^[\%\;](if|el|endi)/)
|
||||
{
|
||||
if ($line =~ /__([A-Z][A-Z0-9_]+)__/)
|
||||
{
|
||||
$line=";$line" unless ($line =~ /^\;/);
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "$in:$i:warning 2:$line";
|
||||
}
|
||||
}
|
||||
$line =~ s/\.ash/\.asy/ if ($line =~ /^\s*\%include/);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$cs = "";
|
||||
$i = 0;
|
||||
|
||||
# 2nd pass
|
||||
for $line (@lines)
|
||||
{
|
||||
if ($line =~ /^\s+(j\w+|loop|call)\s+(\w*)/)
|
||||
{
|
||||
$label = $2;
|
||||
die "$line" if ($label =~ /(\bnear\b|\bshort\b)/);
|
||||
if (defined $labels{$label})
|
||||
{
|
||||
$ts = $labels{$label};
|
||||
if ($ts ne $cs)
|
||||
{
|
||||
$line =~ s/$label/J$i$ilabel/;
|
||||
print OU $line;
|
||||
print OU "J$i$ilabel:\n";
|
||||
print OU "\t\tsection\t.data\n\t\tdd\t";
|
||||
print OU "0,J$i$ilabel\n\t\tdb\t\'$ts\',0\n\t\tdd\t$label - S$ts$ilabel\n";
|
||||
print OU "\t\tsection\t.text\n\n";
|
||||
$line = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$line = ";$line" if ($line =~ /^\s+align\s/);
|
||||
|
||||
print OU $line;
|
||||
if ($line =~ /__([A-Z][A-Z0-9_]+)__/)
|
||||
{
|
||||
print OU "S$1$ilabel:\n";
|
||||
print OU "\t\tsection\t.data\n\t\tdb\t\'$1\',0\n\t\tdd\tS$1$ilabel\n";
|
||||
print OU "\t\tsection\t.text\n\n";
|
||||
$cs = $1;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
# vi:ts=4:et
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
; upx_itoa.asm -- decimal print; smaller than gcc, and no relocations
|
||||
; upx_itoa.S -- decimal print; smaller than gcc, and no relocations
|
||||
;
|
||||
; This file is part of the UPX executable compressor.
|
||||
;
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
; 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
|
||||
; <jreiser@users.sourceforge.net>
|
||||
;
|
||||
|
||||
|
||||
BITS 32
|
||||
SECTION .text
|
||||
CPU 386
|
||||
GLOBAL 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 byte 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, byte '0'
|
||||
stosb
|
||||
ret
|
||||
|
||||
|
||||
; vi:ts=8:et:nowrap
|
|
@ -1,155 +0,0 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# app_m68k.pl -- assembly preprocessor for upx
|
||||
#
|
||||
# This file is part of the UPX executable compressor.
|
||||
#
|
||||
# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
||||
# Copyright (C) 1996-2006 Laszlo Molnar
|
||||
# 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.
|
||||
#
|
||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
# <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||
#
|
||||
|
||||
#
|
||||
# usage: app_m68k.pl infile outfile
|
||||
#
|
||||
|
||||
$in = shift || die;
|
||||
$ou = shift || die;
|
||||
|
||||
open (IN,"<$in") or die;
|
||||
open (OU,">$ou") or die;
|
||||
binmode IN;
|
||||
binmode OU;
|
||||
|
||||
@lines = <IN>;
|
||||
|
||||
%labels = ();
|
||||
$i = 0;
|
||||
$cs = "";
|
||||
|
||||
($ilabel = $in) =~ s,^.*[\/\\],,; # get basename
|
||||
$ilabel =~ s/\W//g;
|
||||
|
||||
# 1st pass
|
||||
for $line (@lines)
|
||||
{
|
||||
$labels{$1} = "$cs" if ($line =~ /^(\w+):/ && $cs);
|
||||
if ($line =~ /__([A-Z0-9]{8})__/) {
|
||||
$cs = $1;
|
||||
# verify the line
|
||||
if ($line =~ /^[\%\;]ifdef/) {
|
||||
# ok
|
||||
} elsif ($line =~ /^([\%\;]\w+)?\s*;/) {
|
||||
# ok
|
||||
} else {
|
||||
print STDERR "$in:$i:warning 1:$line"
|
||||
}
|
||||
}
|
||||
|
||||
if ($line =~ /^[\%\;](if|el|endi)/)
|
||||
{
|
||||
if ($line =~ /__([A-Z0-9]{8})__/)
|
||||
{
|
||||
$line=";$line" unless ($line =~ /^\;/);
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "$in:$i:warning 2:$line";
|
||||
}
|
||||
}
|
||||
$line =~ s/\.ash/\.asy/ if ($line =~ /^\s*\%include/);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$cs = "";
|
||||
$i = 0;
|
||||
|
||||
@data = ();
|
||||
|
||||
# 2nd pass
|
||||
for $line (@lines)
|
||||
{
|
||||
last if ($line =~ /^\s*end\b/i);
|
||||
|
||||
if ($line =~ /^\s+(b[\w\.]+|db[\w\.]+)\s+(\w*)/)
|
||||
{
|
||||
$label = $2;
|
||||
##print STDERR "$label $cs\n"; # debug
|
||||
if (defined $labels{$label})
|
||||
{
|
||||
$ts = $labels{$label};
|
||||
if ($ts ne $cs)
|
||||
{
|
||||
$line =~ s/$label/J$i$ilabel/;
|
||||
print OU $line;
|
||||
print OU "J$i$ilabel:\n";
|
||||
$d = "dc.l\t0, J$i$ilabel";
|
||||
push(@data, $d);
|
||||
$d = "dc.b\t'$ts'";
|
||||
push(@data, $d);
|
||||
$d = "dc.l\t$label - S$ts$ilabel";
|
||||
push(@data, $d);
|
||||
$line = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$line = ";$line" if ($line =~ /^\s+align\b/i);
|
||||
$line = ";$line" if ($line =~ /^\s+even\b/i);
|
||||
|
||||
if ($line =~ /^;*\s+print_data\b/i) {
|
||||
&print_data();
|
||||
} else {
|
||||
print OU $line;
|
||||
}
|
||||
|
||||
if ($line =~ /__([A-Z0-9]{8})__/)
|
||||
{
|
||||
print OU "S$1$ilabel:\n";
|
||||
$cs = $1;
|
||||
$d = "dc.b\t'$1'";
|
||||
push(@data, $d);
|
||||
$d = "dc.l\tS$1$ilabel";
|
||||
push(@data, $d);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
&print_data();
|
||||
print OU "\t\tend\n";
|
||||
exit(0);
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# //
|
||||
# ************************************************************************/
|
||||
|
||||
sub print_data {
|
||||
return if ($#data < 0);
|
||||
###print OU "\n\n\t\tsection_data\n";
|
||||
local ($d);
|
||||
for $d (@data) {
|
||||
print OU "\t\t$d\n";
|
||||
}
|
||||
@data = ();
|
||||
}
|
||||
|
||||
# vi:ts=4:et
|
|
@ -21,8 +21,8 @@
|
|||
; If not, write to the Free Software Foundation, Inc.,
|
||||
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
;
|
||||
; Markus F.X.J. Oberhumer Jens Medoch
|
||||
; <markus@oberhumer.com> <jssg@users.sourceforge.net>
|
||||
; Markus F.X.J. Oberhumer Jens Medoch
|
||||
; <markus@oberhumer.com> <jssg@users.sourceforge.net>
|
||||
; http://www.oberhumer.com/opensource/ucl/
|
||||
;
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
.macro nrv2b done
|
||||
|
||||
local n2b_1, n2b_2, n2b_3,
|
||||
local n2b_1, n2b_2, n2b_3
|
||||
local n2b_4, n2b_5, n2b_6
|
||||
|
||||
init
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
.macro nrv2d done
|
||||
|
||||
local n2d_1, n2d_2, n2d_3, n2d_4,
|
||||
local n2d_1, n2d_2, n2d_3, n2d_4
|
||||
local n2d_5, n2d_6, n2d_7
|
||||
|
||||
init
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
;
|
||||
; Markus F.X.J. Oberhumer Jens Medoch
|
||||
; <markus@oberhumer.com> <jssg@users.sourceforge.net>
|
||||
; http$://www.oberhumer.com/opensource/ucl/
|
||||
; http://www.oberhumer.com/opensource/ucl/
|
||||
;
|
||||
*/
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
.macro nrv2e done
|
||||
|
||||
local n2e_1, n2e_2, n2e_3, n2e_4,
|
||||
local n2e_1, n2e_2, n2e_3, n2e_4
|
||||
local n2e_5, n2e_6, n2e_7
|
||||
|
||||
init
|
||||
|
|
|
@ -87,7 +87,7 @@ upx_itoa(unsigned long v, char *buf);
|
|||
// Some versions of gcc optimize the division and/or remainder using
|
||||
// a multiplication by (2**32)/10, and use a relocatable 32-bit address
|
||||
// to reference the constant. We require no relocations because we move
|
||||
// the code at runtime. See upx_itoa.asm for replacement [also smaller.]
|
||||
// the code at runtime. See upx_itoa.S for replacement [also smaller.]
|
||||
static char *upx_itoa(unsigned long v, char *buf)
|
||||
{
|
||||
// const unsigned TEN = 10;
|
||||
|
|
Loading…
Reference in New Issue
Block a user