From 75294b9146201289288e78f5b2ef11648d16a369 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Sun, 2 Jul 2006 19:27:08 -0700 Subject: [PATCH] FreeBSD, NetBSD, OpenBSD on equal footing --- src/p_lx_elf.cpp | 16 +++--- src/stub/Makefile | 56 +++++++++---------- ...6-BSD.elf-entry.h => i386-bsd.elf-entry.h} | 2 +- ...386-BSD.elf-fold.h => i386-bsd.elf-fold.h} | 4 +- src/stub/scripts/{brandBSD.pl => brandbsd.pl} | 0 ...D.elf-entry.asm => i386-bsd.elf-entry.asm} | 0 ...BSD.elf-fold.asm => i386-bsd.elf-fold.asm} | 0 ...BSD.elf-fold.lds => i386-bsd.elf-fold.lds} | 0 ...386-BSD.elf-main.c => i386-bsd.elf-main.c} | 2 +- src/stub/src/include/{BSD.h => bsd.h} | 0 10 files changed, 40 insertions(+), 40 deletions(-) rename src/stub/{i386-BSD.elf-entry.h => i386-bsd.elf-entry.h} (99%) rename src/stub/{i386-BSD.elf-fold.h => i386-bsd.elf-fold.h} (98%) rename src/stub/scripts/{brandBSD.pl => brandbsd.pl} (100%) rename src/stub/src/{i386-BSD.elf-entry.asm => i386-bsd.elf-entry.asm} (100%) rename src/stub/src/{i386-BSD.elf-fold.asm => i386-bsd.elf-fold.asm} (100%) rename src/stub/src/{i386-BSD.elf-fold.lds => i386-bsd.elf-fold.lds} (100%) rename src/stub/src/{i386-BSD.elf-main.c => i386-bsd.elf-main.c} (99%) rename src/stub/src/include/{BSD.h => bsd.h} (100%) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 82aa74ca..6d8b93d0 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -587,21 +587,21 @@ PackLinuxElf32x86::buildLoader(const Filter *ft) } static const -#include "stub/i386-BSD.elf-entry.h" +#include "stub/i386-bsd.elf-entry.h" static const -#include "stub/i386-BSD.elf-fold.h" +#include "stub/i386-bsd.elf-fold.h" int PackBSDElf32x86::buildLoader(const Filter *ft) { - unsigned char tmp[sizeof(BSD_i386elf_fold)]; - memcpy(tmp, BSD_i386elf_fold, sizeof(BSD_i386elf_fold)); + unsigned char tmp[sizeof(bsd_i386elf_fold)]; + memcpy(tmp, bsd_i386elf_fold, sizeof(bsd_i386elf_fold)); ((Elf32_Ehdr *)tmp)->e_ident[Elf32_Ehdr::EI_OSABI] = ei_osabi; ((Elf32_Ehdr *)tmp)->e_ident[Elf32_Ehdr::EI_ABIVERSION] = 0; checkPatch(NULL, 0, 0, 0); // reset if (opt->o_unix.is_ptinterp) { unsigned j; - for (j = 0; j < sizeof(BSD_i386elf_fold)-1; ++j) { + for (j = 0; j < sizeof(bsd_i386elf_fold)-1; ++j) { if (0x60==tmp[ j] && 0x47==tmp[1+j] ) { /* put INC EDI before PUSHA: inhibits auxv_up for PT_INTERP */ @@ -612,8 +612,8 @@ PackBSDElf32x86::buildLoader(const Filter *ft) } } return buildLinuxLoader( - BSD_i386elf_loader, sizeof(BSD_i386elf_loader), - tmp, sizeof(BSD_i386elf_fold), ft ); + bsd_i386elf_loader, sizeof(bsd_i386elf_loader), + tmp, sizeof(bsd_i386elf_fold), ft ); } static const @@ -1048,7 +1048,7 @@ void PackLinuxElf32x86::pack1(OutputFile *fo, Filter &ft) void PackBSDElf32x86::pack1(OutputFile *fo, Filter &ft) { PackLinuxElf32::pack1(fo, ft); - generateElfHdr(fo, BSD_i386elf_fold, getbrk(phdri, get_native16(&ehdri.e_phnum)) ); + generateElfHdr(fo, bsd_i386elf_fold, getbrk(phdri, get_native16(&ehdri.e_phnum)) ); } void PackLinuxElf32::ARM_pack1(OutputFile *fo, bool const isBE) diff --git a/src/stub/Makefile b/src/stub/Makefile index 868a6329..e923b895 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -51,8 +51,8 @@ STUBS += i386-dos32.tmt.h STUBS += i386-dos32.watcom.le.h STUBS += i386-linux.elf-entry.h STUBS += i386-linux.elf-fold.h -STUBS += i386-BSD.elf-entry.h -STUBS += i386-BSD.elf-fold.h +STUBS += i386-bsd.elf-entry.h +STUBS += i386-bsd.elf-fold.h STUBS += i386-linux.elf.execve-entry.h STUBS += i386-linux.elf.execve-fold.h STUBS += i386-linux.elf.interp-entry.h @@ -122,7 +122,7 @@ override T = $(basename $(notdir $@)) # default settings for $(tc_list) tc.default.bin2h = python $(srcdir)/scripts/bin2h.py tc.default.brandelf = perl -w $(srcdir)/scripts/brandelf.pl -tc.default.brandBSD = perl -w $(srcdir)/scripts/brandBSD.pl +tc.default.brandbsd = perl -w $(srcdir)/scripts/brandbsd.pl tc.default.djasm = djasm tc.default.gpp_inc = python $(srcdir)/scripts/gpp_inc.py tc.default.m-objcopy = multiarch-objcopy-2.17 @@ -349,46 +349,46 @@ i386-dos32.watcom.le.h : $(srcdir)/src/$$T.asm # /*********************************************************************** -# // i386-BSD.elf +# // i386-bsd.elf # ************************************************************************/ -i386-BSD.elf% : tc_list = i386-BSD.elf arch-i386 default +i386-bsd.elf% : tc_list = i386-bsd.elf arch-i386 default -tc.i386-BSD.elf.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD -tc.i386-BSD.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables -tc.i386-BSD.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror -tc.i386-BSD.elf.gcc += -march=i386 -mtune=k6 -tc.i386-BSD.elf.gcc += -Os -fno-omit-frame-pointer -tc.i386-BSD.elf.gcc += -momit-leaf-frame-pointer -tc.i386-BSD.elf.gcc += -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops -tc.i386-BSD.elf.gcc += -mpreferred-stack-boundary=2 -tc.i386-BSD.elf.gcc += -fweb -##tc.i386-BSD.elf.ld = i386-linux-ld-2.16.1 -##tc.i386-BSD.elf.objcopy = i386-linux-objcopy-2.16.1 -##tc.i386-BSD.elf.objdump = i386-linux-objdump -tc.i386-BSD.elf.ld = $(call tc,m-ld) -b elf32-i386 -tc.i386-BSD.elf.objcopy = $(call tc,m-objcopy) -I elf32-i386 -tc.i386-BSD.elf.objdump = $(call tc,m-objdump) -b elf32-i386 -tc.i386-BSD.elf.objstrip = $(call tc,objcopy) -R .comment -R .note +tc.i386-bsd.elf.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD +tc.i386-bsd.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables +tc.i386-bsd.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror +tc.i386-bsd.elf.gcc += -march=i386 -mtune=k6 +tc.i386-bsd.elf.gcc += -Os -fno-omit-frame-pointer +tc.i386-bsd.elf.gcc += -momit-leaf-frame-pointer +tc.i386-bsd.elf.gcc += -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops +tc.i386-bsd.elf.gcc += -mpreferred-stack-boundary=2 +tc.i386-bsd.elf.gcc += -fweb +##tc.i386-bsd.elf.ld = i386-linux-ld-2.16.1 +##tc.i386-bsd.elf.objcopy = i386-linux-objcopy-2.16.1 +##tc.i386-bsd.elf.objdump = i386-linux-objdump +tc.i386-bsd.elf.ld = $(call tc,m-ld) -b elf32-i386 +tc.i386-bsd.elf.objcopy = $(call tc,m-objcopy) -I elf32-i386 +tc.i386-bsd.elf.objdump = $(call tc,m-objdump) -b elf32-i386 +tc.i386-bsd.elf.objstrip = $(call tc,objcopy) -R .comment -R .note -i386-BSD.elf-entry.h : $(srcdir)/src/$$T.asm +i386-bsd.elf-entry.h : $(srcdir)/src/$$T.asm $(call tc,pp-nasm) $< -o tmp/$T.tmp1 $(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2 $(call tc,nasm) -f bin -l tmp/$T.bin.lst tmp/$T.tmp2 -o tmp/$T.bin - $(call tc,bin2h) --ident=BSD_i386elf_loader tmp/$T.bin $@ + $(call tc,bin2h) --ident=bsd_i386elf_loader tmp/$T.bin $@ -i386-BSD.elf-fold.h : tmp/$$T.o tmp/i386-BSD.elf-main.o $(srcdir)/src/$$T.lds +i386-bsd.elf-fold.h : tmp/$$T.o tmp/i386-bsd.elf-main.o $(srcdir)/src/$$T.lds $(call tc,ld) -T $(srcdir)/src/$T.lds -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^) $(call tc,objstrip) tmp/$T.bin $(call tc,sstrip) tmp/$T.bin - $(call tc,brandBSD) tmp/$T.bin - $(call tc,bin2h) --ident=BSD_i386elf_fold tmp/$T.bin $@ + $(call tc,brandbsd) tmp/$T.bin + $(call tc,bin2h) --ident=bsd_i386elf_fold tmp/$T.bin $@ -tmp/i386-BSD.elf-fold.o : $(srcdir)/src/$$T.asm +tmp/i386-bsd.elf-fold.o : $(srcdir)/src/$$T.asm $(call tc,nasm) -f elf -l $@.lst $< -o $@ $(call tc,objstrip) $@ -tmp/i386-BSD.elf-main.o : $(srcdir)/src/$$T.c +tmp/i386-bsd.elf-main.o : $(srcdir)/src/$$T.c $(call tc,gcc) -c $< -o $@ $(call tc,objstrip) $@ diff --git a/src/stub/i386-BSD.elf-entry.h b/src/stub/i386-bsd.elf-entry.h similarity index 99% rename from src/stub/i386-BSD.elf-entry.h rename to src/stub/i386-bsd.elf-entry.h index 981908cc..91725583 100644 --- a/src/stub/i386-BSD.elf-entry.h +++ b/src/stub/i386-bsd.elf-entry.h @@ -31,7 +31,7 @@ #define BSD_I386ELF_LOADER_ADLER32 0xf87da5ea #define BSD_I386ELF_LOADER_CRC32 0x5c4c2f5c -unsigned char BSD_i386elf_loader[10972] = { +unsigned char bsd_i386elf_loader[10972] = { 232, 0, 0, 0, 0, 96,106, 63,139,116, 36, 40,139,124, 36, 48, /* 0x 0 */ 131,205,255,235, 0,164,235, 0,138, 6, 70,136, 7, 71, 1,219, /* 0x 10 */ 117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7, /* 0x 20 */ diff --git a/src/stub/i386-BSD.elf-fold.h b/src/stub/i386-bsd.elf-fold.h similarity index 98% rename from src/stub/i386-BSD.elf-fold.h rename to src/stub/i386-bsd.elf-fold.h index 76b182ff..bae6ed04 100644 --- a/src/stub/i386-BSD.elf-fold.h +++ b/src/stub/i386-bsd.elf-fold.h @@ -1,4 +1,4 @@ -/* i386-BSD.elf-fold.h -- created from i386-BSD.elf-fold.bin, 1702 (0x6a6) bytes +/* i386-bsd.elf-fold.h -- created from i386-bsd.elf-fold.bin, 1702 (0x6a6) bytes This file is part of the UPX executable compressor. @@ -31,7 +31,7 @@ #define BSD_I386ELF_FOLD_ADLER32 0xd3fbf52c #define BSD_I386ELF_FOLD_CRC32 0x627f021f -unsigned char BSD_i386elf_fold[1702] = { +unsigned char bsd_i386elf_fold[1702] = { 127, 69, 76, 70, 1, 1, 1, 9, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x 0 */ 2, 0, 3, 0, 1, 0, 0, 0,128, 16,192, 0, 52, 0, 0, 0, /* 0x 10 */ 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */ diff --git a/src/stub/scripts/brandBSD.pl b/src/stub/scripts/brandbsd.pl similarity index 100% rename from src/stub/scripts/brandBSD.pl rename to src/stub/scripts/brandbsd.pl diff --git a/src/stub/src/i386-BSD.elf-entry.asm b/src/stub/src/i386-bsd.elf-entry.asm similarity index 100% rename from src/stub/src/i386-BSD.elf-entry.asm rename to src/stub/src/i386-bsd.elf-entry.asm diff --git a/src/stub/src/i386-BSD.elf-fold.asm b/src/stub/src/i386-bsd.elf-fold.asm similarity index 100% rename from src/stub/src/i386-BSD.elf-fold.asm rename to src/stub/src/i386-bsd.elf-fold.asm diff --git a/src/stub/src/i386-BSD.elf-fold.lds b/src/stub/src/i386-bsd.elf-fold.lds similarity index 100% rename from src/stub/src/i386-BSD.elf-fold.lds rename to src/stub/src/i386-bsd.elf-fold.lds diff --git a/src/stub/src/i386-BSD.elf-main.c b/src/stub/src/i386-bsd.elf-main.c similarity index 99% rename from src/stub/src/i386-BSD.elf-main.c rename to src/stub/src/i386-bsd.elf-main.c index f8e64bf9..f36a545b 100644 --- a/src/stub/src/i386-BSD.elf-main.c +++ b/src/stub/src/i386-bsd.elf-main.c @@ -30,7 +30,7 @@ */ -#include "include/BSD.h" +#include "include/bsd.h" /************************************************************************* diff --git a/src/stub/src/include/BSD.h b/src/stub/src/include/bsd.h similarity index 100% rename from src/stub/src/include/BSD.h rename to src/stub/src/include/bsd.h