Stub: remove files again which seem to have been brought back by some merge.
This commit is contained in:
@@ -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,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
|
||||
@@ -1,111 +0,0 @@
|
||||
#! /usr/bin/perl -w
|
||||
#
|
||||
# app_mr3k.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_mr3k.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;
|
||||
$test = "";
|
||||
|
||||
# 2nd pass
|
||||
for $line (@lines)
|
||||
{
|
||||
$line = ";$line" if ($line =~ /^\s+align\s/);
|
||||
|
||||
print OU $line;
|
||||
|
||||
if ($line =~ /__([A-Z0-9]{8})__/)
|
||||
{
|
||||
print OU "S$1$ilabel:\n";
|
||||
push @{ $test[++$#test] }, "\t\tDB\t\t\"$1\",0\n\t\tDW_UNALIGNED\tS$1$ilabel\n";
|
||||
|
||||
$cs = $1;
|
||||
}
|
||||
$i++;
|
||||
|
||||
if ($line =~ /section .data/)
|
||||
{
|
||||
for $i ( 0 .. $#test )
|
||||
{
|
||||
print OU "@{$test[$i]}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# vi:ts=4:et
|
||||
@@ -1,50 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# asl_m68k.sh --
|
||||
#
|
||||
# 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>
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
# wrapper for the ASL cross-assembler (version 1.42bld43)
|
||||
# http://john.ccac.rwth-aachen.de:8000/as/
|
||||
# http://john.ccac.rwth-aachen.de:8000/ftp/as/source/c_version/
|
||||
|
||||
file="$1"
|
||||
test -f "$file" || exit 1
|
||||
|
||||
ofile=`echo "$file" | sed 's/\.[a-z]*$/.o/'`
|
||||
|
||||
# convert ' to " in dc.x statements
|
||||
perl -p -i -e '
|
||||
s,\x27,",g if m,^\s*dc\.,;
|
||||
' "$file"
|
||||
|
||||
echo asl -q -xC -U -cpu 68000 -o "$ofile" -L "$file"
|
||||
asl -q -xC -U -cpu 68000 -o "$ofile" -L "$file"
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
#! /usr/bin/perl -w
|
||||
#
|
||||
# bin2h.pl --
|
||||
#
|
||||
# This file is part of the UPX executable compressor.
|
||||
#
|
||||
# Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
||||
# Copyright (C) 1996-2006 Laszlo Molnar
|
||||
# Copyright (C) 2000-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.
|
||||
#
|
||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
# <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||
#
|
||||
|
||||
|
||||
use Compress::Zlib;
|
||||
|
||||
$delim = $/;
|
||||
undef $/; # undef input record separator - read file as a whole
|
||||
|
||||
$ifile = shift || die;
|
||||
$ident = shift || die;
|
||||
$ofile = shift || die;
|
||||
|
||||
$opt_q = "";
|
||||
$opt_q = shift if ($#ARGV >= 0);
|
||||
|
||||
# open ifile
|
||||
open(INFILE,$ifile) || die "open $ifile\n";
|
||||
binmode(INFILE);
|
||||
|
||||
# check file size
|
||||
@st = stat($ifile);
|
||||
if (1 && $st[7] <= 0) {
|
||||
print STDERR "$ifile: ERROR: emtpy file\n";
|
||||
exit(1);
|
||||
}
|
||||
if (1 && $st[7] > 64*1024) {
|
||||
print STDERR "$ifile: ERROR: file is too big (${st[7]} bytes)\n";
|
||||
if ($ifile =~ /^fold/) {
|
||||
print STDERR " (please upgrade your binutils to 2.12.90.0.15 or better)\n";
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
# read whole file
|
||||
$data = <INFILE>;
|
||||
close(INFILE) || die;
|
||||
$n = length($data);
|
||||
die if ($n != $st[7]);
|
||||
|
||||
# open ofile
|
||||
open(OUTFILE,">$ofile") || die "open $ofile\n";
|
||||
binmode(OUTFILE);
|
||||
select(OUTFILE);
|
||||
|
||||
$if = $ifile;
|
||||
$if =~ s/.*[\/\\]//;
|
||||
$of = $ofile;
|
||||
$of =~ s/.*[\/\\]//;
|
||||
|
||||
if ($opt_q ne "-q") {
|
||||
printf ("/* %s -- created from %s, %d (0x%x) bytes\n", $of, $if, $n, $n);
|
||||
print <<"EOF";
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2006 Laszlo Molnar
|
||||
Copyright (C) 2000-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.
|
||||
|
||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
<mfx\@users.sourceforge.net> <ml1050\@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
$s = $ident;
|
||||
$s =~ tr/a-z/A-Z/;
|
||||
printf("#define %s_SIZE %d\n", $s, $n);
|
||||
printf("#define %s_ADLER32 0x%08x\n", $s, &adler32($data));
|
||||
printf("#define %s_CRC32 0x%08x\n", $s, &crc32($data));
|
||||
printf("\n");
|
||||
|
||||
printf("unsigned char %s[%d] = {", $ident, $n);
|
||||
for ($i = 0; $i < $n; $i++) {
|
||||
if ($i % 16 == 0) {
|
||||
printf(" /* 0x%4x */", $i - 16) if $i > 0;
|
||||
print "\n";
|
||||
}
|
||||
printf("%3d", ord(substr($data, $i, 1)));
|
||||
print "," if ($i != $n - 1);
|
||||
}
|
||||
|
||||
while (($i % 16) != 0) {
|
||||
$i++;
|
||||
print " ";
|
||||
}
|
||||
printf(" /* 0x%4x */", $i - 16);
|
||||
|
||||
print "\n};\n";
|
||||
|
||||
close(OUTFILE) || die;
|
||||
select(STDOUT);
|
||||
|
||||
undef $delim;
|
||||
exit(0);
|
||||
|
||||
# vi:ts=4:et
|
||||
@@ -1,58 +0,0 @@
|
||||
#! /usr/bin/perl -w
|
||||
#
|
||||
# setfold.pl -- set Elf32_Phdr[1].p_offset
|
||||
#
|
||||
# This file is part of the UPX executable compressor.
|
||||
#
|
||||
# Copyright (C) 2000-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.
|
||||
#
|
||||
# Markus F.X.J. Oberhumer Laszlo Molnar
|
||||
# <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
||||
#
|
||||
# John F. Reiser
|
||||
# <jreiser@users.sourceforge.net>
|
||||
#
|
||||
|
||||
|
||||
$fname = shift || die;
|
||||
sysopen (FH,$fname,2) || die;
|
||||
binmode FH;
|
||||
|
||||
$fsize = (stat($fname))[7];
|
||||
|
||||
$val = shift || die "$val";
|
||||
###print STDERR "$val\n";
|
||||
$val = oct($val); # acutally hex()
|
||||
$val = $val & 0xfff;
|
||||
printf STDERR "setfold info: $fname: setting fold to 0x%x, file size 0x%x\n", $val, $fsize;
|
||||
die unless $val > 0;
|
||||
die unless $val < $fsize;
|
||||
$num = pack("V", $val);
|
||||
|
||||
# 0x34 = sizeof(Elf32_Ehdr)
|
||||
# 0x20 = sizeof(Elf32_Phdr)
|
||||
# 4 = offset(p_offset)
|
||||
sysseek (FH,0x34+0x20+4,0) || die;
|
||||
|
||||
syswrite (FH,$num,4) || die;
|
||||
|
||||
close(FH) || die;
|
||||
exit 0;
|
||||
|
||||
# vi:ts=4:et
|
||||
@@ -1,52 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# setfold.sh --
|
||||
#
|
||||
# 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>
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
file="$1"
|
||||
|
||||
# get directory of this script
|
||||
bindir=`echo "$0" | sed -e 's|[^/][^/]*$||'`
|
||||
bindir=`cd "$bindir" && pwd`
|
||||
|
||||
sstrip="./util/sstrip/sstrip"
|
||||
test -x "$sstrip" || sstrip="$bindir/../util/sstrip/sstrip"
|
||||
|
||||
# get address of symbol "fold_begin"
|
||||
fold=`nm -f bsd "$file" | grep fold_begin | sed 's/^0*\([0-9a-fA-F]*\).*/0x\1/'`
|
||||
|
||||
# strip
|
||||
objcopy -S -R .comment -R .note "$file"
|
||||
"$sstrip" "$file"
|
||||
|
||||
# patch address
|
||||
perl -w "$bindir/setfold.pl" "$file" "$fold"
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
#! /usr/bin/perl -w
|
||||
#
|
||||
# stripelf.pl -- strip section headers from an ELF executable
|
||||
#
|
||||
# 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>
|
||||
#
|
||||
|
||||
#
|
||||
# Strip section headers from the Linux stub. Section headers are
|
||||
# optional for executables, but nevertheless binutils (2.9.1.0.25)
|
||||
# complain with a "File format not recognized" error.
|
||||
# Looks like a bug in binutils to me.
|
||||
#
|
||||
# A positive side effect of this is that `strip' cannot ruin an UPX
|
||||
# compressed file any longer.
|
||||
#
|
||||
|
||||
$fname = shift || die;
|
||||
sysopen (FH,$fname,2) || die;
|
||||
binmode FH;
|
||||
|
||||
sysseek (FH,0x20,0) || die;
|
||||
sysread (FH,$num,4) || die;
|
||||
$shpos = unpack ("V",$num); # e_shoff
|
||||
|
||||
sysseek (FH,0x2e,0) || die;
|
||||
sysread (FH,$num,2) || die;
|
||||
$ssize = unpack ("v",$num); # e_shentsize
|
||||
|
||||
sysseek (FH,0x32,0) || die;
|
||||
sysread (FH,$num,2) || die;
|
||||
$idx = unpack ("v",$num); # e_shstrndx
|
||||
|
||||
sysseek (FH,$shpos + $idx * $ssize + 16,0) || die;
|
||||
sysread (FH,$num,4) || die;
|
||||
$neweof = unpack ("V",$num); # sh_offset of the e_shstrndx section
|
||||
|
||||
$num = pack ("x6");
|
||||
sysseek (FH,0x20,0) || die;
|
||||
syswrite (FH,$num,4) || die; # clear e_shoff
|
||||
|
||||
if (1) {
|
||||
sysseek (FH,0x2e,0) || die;
|
||||
syswrite (FH,$num,6) || die; # clear e_shentsize, e_shnum & e_shstrndx
|
||||
} else {
|
||||
sysseek (FH,0x30,0) || die;
|
||||
syswrite (FH,$num,4) || die; # clear e_shnum & e_shstrndx
|
||||
}
|
||||
|
||||
truncate (FH,$neweof) || die;
|
||||
close(FH) || die;
|
||||
|
||||
print STDOUT "$0: truncated $fname to $neweof bytes.\n";
|
||||
exit 0;
|
||||
|
||||
# vi:ts=4:et
|
||||
@@ -1,42 +0,0 @@
|
||||
#! /usr/bin/perl -w
|
||||
#
|
||||
# version.pl -- convert version.h into version.asy
|
||||
#
|
||||
# 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>
|
||||
#
|
||||
|
||||
|
||||
$mode = shift || "--nasm";
|
||||
while (<>) {
|
||||
chop;
|
||||
s/\s+$//;
|
||||
if (/^\s*\#\s*define\s+(.*)/) {
|
||||
print "%define $1\n" if ($mode eq "--nasm");
|
||||
}
|
||||
}
|
||||
|
||||
exit (0);
|
||||
|
||||
# vi:ts=4:et
|
||||
Reference in New Issue
Block a user