FreeBSD, NetBSD, OpenBSD on equal footing
This commit is contained in:
+8
-8
@@ -587,21 +587,21 @@ PackLinuxElf32x86::buildLoader(const Filter *ft)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const
|
static const
|
||||||
#include "stub/i386-BSD.elf-entry.h"
|
#include "stub/i386-bsd.elf-entry.h"
|
||||||
static const
|
static const
|
||||||
#include "stub/i386-BSD.elf-fold.h"
|
#include "stub/i386-bsd.elf-fold.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
PackBSDElf32x86::buildLoader(const Filter *ft)
|
PackBSDElf32x86::buildLoader(const Filter *ft)
|
||||||
{
|
{
|
||||||
unsigned char tmp[sizeof(BSD_i386elf_fold)];
|
unsigned char tmp[sizeof(bsd_i386elf_fold)];
|
||||||
memcpy(tmp, BSD_i386elf_fold, 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_OSABI] = ei_osabi;
|
||||||
((Elf32_Ehdr *)tmp)->e_ident[Elf32_Ehdr::EI_ABIVERSION] = 0;
|
((Elf32_Ehdr *)tmp)->e_ident[Elf32_Ehdr::EI_ABIVERSION] = 0;
|
||||||
checkPatch(NULL, 0, 0, 0); // reset
|
checkPatch(NULL, 0, 0, 0); // reset
|
||||||
if (opt->o_unix.is_ptinterp) {
|
if (opt->o_unix.is_ptinterp) {
|
||||||
unsigned j;
|
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]
|
if (0x60==tmp[ j]
|
||||||
&& 0x47==tmp[1+j] ) {
|
&& 0x47==tmp[1+j] ) {
|
||||||
/* put INC EDI before PUSHA: inhibits auxv_up for PT_INTERP */
|
/* put INC EDI before PUSHA: inhibits auxv_up for PT_INTERP */
|
||||||
@@ -612,8 +612,8 @@ PackBSDElf32x86::buildLoader(const Filter *ft)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buildLinuxLoader(
|
return buildLinuxLoader(
|
||||||
BSD_i386elf_loader, sizeof(BSD_i386elf_loader),
|
bsd_i386elf_loader, sizeof(bsd_i386elf_loader),
|
||||||
tmp, sizeof(BSD_i386elf_fold), ft );
|
tmp, sizeof(bsd_i386elf_fold), ft );
|
||||||
}
|
}
|
||||||
|
|
||||||
static const
|
static const
|
||||||
@@ -1048,7 +1048,7 @@ void PackLinuxElf32x86::pack1(OutputFile *fo, Filter &ft)
|
|||||||
void PackBSDElf32x86::pack1(OutputFile *fo, Filter &ft)
|
void PackBSDElf32x86::pack1(OutputFile *fo, Filter &ft)
|
||||||
{
|
{
|
||||||
PackLinuxElf32::pack1(fo, 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)
|
void PackLinuxElf32::ARM_pack1(OutputFile *fo, bool const isBE)
|
||||||
|
|||||||
+28
-28
@@ -51,8 +51,8 @@ STUBS += i386-dos32.tmt.h
|
|||||||
STUBS += i386-dos32.watcom.le.h
|
STUBS += i386-dos32.watcom.le.h
|
||||||
STUBS += i386-linux.elf-entry.h
|
STUBS += i386-linux.elf-entry.h
|
||||||
STUBS += i386-linux.elf-fold.h
|
STUBS += i386-linux.elf-fold.h
|
||||||
STUBS += i386-BSD.elf-entry.h
|
STUBS += i386-bsd.elf-entry.h
|
||||||
STUBS += i386-BSD.elf-fold.h
|
STUBS += i386-bsd.elf-fold.h
|
||||||
STUBS += i386-linux.elf.execve-entry.h
|
STUBS += i386-linux.elf.execve-entry.h
|
||||||
STUBS += i386-linux.elf.execve-fold.h
|
STUBS += i386-linux.elf.execve-fold.h
|
||||||
STUBS += i386-linux.elf.interp-entry.h
|
STUBS += i386-linux.elf.interp-entry.h
|
||||||
@@ -122,7 +122,7 @@ override T = $(basename $(notdir $@))
|
|||||||
# default settings for $(tc_list)
|
# default settings for $(tc_list)
|
||||||
tc.default.bin2h = python $(srcdir)/scripts/bin2h.py
|
tc.default.bin2h = python $(srcdir)/scripts/bin2h.py
|
||||||
tc.default.brandelf = perl -w $(srcdir)/scripts/brandelf.pl
|
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.djasm = djasm
|
||||||
tc.default.gpp_inc = python $(srcdir)/scripts/gpp_inc.py
|
tc.default.gpp_inc = python $(srcdir)/scripts/gpp_inc.py
|
||||||
tc.default.m-objcopy = multiarch-objcopy-2.17
|
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 = 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 += -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 += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||||
tc.i386-BSD.elf.gcc += -march=i386 -mtune=k6
|
tc.i386-bsd.elf.gcc += -march=i386 -mtune=k6
|
||||||
tc.i386-BSD.elf.gcc += -Os -fno-omit-frame-pointer
|
tc.i386-bsd.elf.gcc += -Os -fno-omit-frame-pointer
|
||||||
tc.i386-BSD.elf.gcc += -momit-leaf-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 += -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 += -mpreferred-stack-boundary=2
|
||||||
tc.i386-BSD.elf.gcc += -fweb
|
tc.i386-bsd.elf.gcc += -fweb
|
||||||
##tc.i386-BSD.elf.ld = i386-linux-ld-2.16.1
|
##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.objcopy = i386-linux-objcopy-2.16.1
|
||||||
##tc.i386-BSD.elf.objdump = i386-linux-objdump
|
##tc.i386-bsd.elf.objdump = i386-linux-objdump
|
||||||
tc.i386-BSD.elf.ld = $(call tc,m-ld) -b elf32-i386
|
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.objcopy = $(call tc,m-objcopy) -I elf32-i386
|
||||||
tc.i386-BSD.elf.objdump = $(call tc,m-objdump) -b 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.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,pp-nasm) $< -o tmp/$T.tmp1
|
||||||
$(call tc,app-nasm) tmp/$T.tmp1 tmp/$T.tmp2
|
$(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,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,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,objstrip) tmp/$T.bin
|
||||||
$(call tc,sstrip) tmp/$T.bin
|
$(call tc,sstrip) tmp/$T.bin
|
||||||
$(call tc,brandBSD) tmp/$T.bin
|
$(call tc,brandbsd) tmp/$T.bin
|
||||||
$(call tc,bin2h) --ident=BSD_i386elf_fold 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,nasm) -f elf -l $@.lst $< -o $@
|
||||||
$(call tc,objstrip) $@
|
$(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,gcc) -c $< -o $@
|
||||||
$(call tc,objstrip) $@
|
$(call tc,objstrip) $@
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#define BSD_I386ELF_LOADER_ADLER32 0xf87da5ea
|
#define BSD_I386ELF_LOADER_ADLER32 0xf87da5ea
|
||||||
#define BSD_I386ELF_LOADER_CRC32 0x5c4c2f5c
|
#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 */
|
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 */
|
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 */
|
117, 7,139, 30,131,238,252, 17,219,114, 0, 49,192, 64,138, 7, /* 0x 20 */
|
||||||
@@ -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.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
#define BSD_I386ELF_FOLD_ADLER32 0xd3fbf52c
|
#define BSD_I386ELF_FOLD_ADLER32 0xd3fbf52c
|
||||||
#define BSD_I386ELF_FOLD_CRC32 0x627f021f
|
#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 */
|
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 */
|
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 */
|
0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 32, 0, 2, 0, 0, 0, /* 0x 20 */
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "include/BSD.h"
|
#include "include/bsd.h"
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
Reference in New Issue
Block a user