ElfLinker::addSection ==> addLoader
This commit is contained in:
commit
117a721166
14
doc/Makefile
14
doc/Makefile
@ -8,8 +8,8 @@ PACKAGE = upx
|
|||||||
VERSION_DATE := $(shell sed -n 's/^.*UPX_VERSION_DATE_ISO .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
VERSION_DATE := $(shell sed -n 's/^.*UPX_VERSION_DATE_ISO .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
||||||
VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
||||||
|
|
||||||
TRIMSPACE = sed -e 's/[ ]*$$//'
|
RTRIM := sed -e 's/[ ]*$$//'
|
||||||
DETAB2 = sed -e 's/ / /g'
|
DETAB2 := sed -e 's/ / /g'
|
||||||
|
|
||||||
BUILT_SOURCES = upx.1 upx.doc upx.html upx.man upx.ps upx.tex
|
BUILT_SOURCES = upx.1 upx.doc upx.html upx.man upx.ps upx.tex
|
||||||
BUILT_SOURCES = upx.1 upx.doc upx.html
|
BUILT_SOURCES = upx.1 upx.doc upx.html
|
||||||
@ -34,20 +34,20 @@ mostlyclean clean distclean maintainer-clean:
|
|||||||
.SUFFIXES: .1 .doc .html .man .pod .ps .tex
|
.SUFFIXES: .1 .doc .html .man .pod .ps .tex
|
||||||
|
|
||||||
%.1 : %.pod
|
%.1 : %.pod
|
||||||
pod2man --center=" " --release="$(PACKAGE) $(VERSION)" --date="$(VERSION_DATE)" $< | $(TRIMSPACE) > $@
|
pod2man --center=" " --release="$(PACKAGE) $(VERSION)" --date="$(VERSION_DATE)" $< | $(RTRIM) > $@
|
||||||
|
|
||||||
%.doc : %.pod
|
%.doc : %.pod
|
||||||
pod2text < $< | $(TRIMSPACE) > $@
|
pod2text < $< | $(RTRIM) > $@
|
||||||
|
|
||||||
%.html : %.pod
|
%.html : %.pod
|
||||||
pod2html --noindex $< | $(TRIMSPACE) | $(DETAB2) > $@
|
pod2html --noindex $< | $(RTRIM) | $(DETAB2) > $@
|
||||||
@rm -f pod2htm*
|
@rm -f pod2htm*
|
||||||
|
|
||||||
%.man : %.1
|
%.man : %.1
|
||||||
nroff -man $< | $(TRIMSPACE) > $@
|
nroff -man $< | $(RTRIM) > $@
|
||||||
|
|
||||||
%.ps : %.1
|
%.ps : %.1
|
||||||
groff -man $< | $(TRIMSPACE) > $@
|
groff -man $< | $(RTRIM) > $@
|
||||||
|
|
||||||
%.tex : %.pod
|
%.tex : %.pod
|
||||||
pod2latex $<
|
pod2latex $<
|
||||||
|
|||||||
@ -285,7 +285,7 @@ void ElfLinker::init(const void *pdata, int plen)
|
|||||||
preprocessSections(psections, psymbols);
|
preprocessSections(psections, psymbols);
|
||||||
preprocessSymbols(psymbols, prelocs);
|
preprocessSymbols(psymbols, prelocs);
|
||||||
preprocessRelocations(prelocs, (char*) input + inputlen);
|
preprocessRelocations(prelocs, (char*) input + inputlen);
|
||||||
addSection("*UND*");
|
addLoader("*UND*");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElfLinker::setLoaderAlignOffset(int phase)
|
void ElfLinker::setLoaderAlignOffset(int phase)
|
||||||
@ -294,7 +294,7 @@ void ElfLinker::setLoaderAlignOffset(int phase)
|
|||||||
printf("\nFIXME: ElfLinker::setLoaderAlignOffset %d\n", phase);
|
printf("\nFIXME: ElfLinker::setLoaderAlignOffset %d\n", phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ElfLinker::addSection(const char *sname)
|
int ElfLinker::addLoader(const char *sname)
|
||||||
{
|
{
|
||||||
assert(!frozen);
|
assert(!frozen);
|
||||||
if (sname[0] == 0)
|
if (sname[0] == 0)
|
||||||
|
|||||||
@ -78,7 +78,7 @@ public:
|
|||||||
|
|
||||||
virtual void init(const void *pdata, int plen);
|
virtual void init(const void *pdata, int plen);
|
||||||
virtual void setLoaderAlignOffset(int phase);
|
virtual void setLoaderAlignOffset(int phase);
|
||||||
virtual int addSection(const char *sname);
|
virtual int addLoader(const char *sname);
|
||||||
virtual void addSection(const char *sname, const void *sdata, int slen, int align);
|
virtual void addSection(const char *sname, const void *sdata, int slen, int align);
|
||||||
virtual void freeze();
|
virtual void freeze();
|
||||||
virtual int getSection(const char *sname, int *slen=NULL);
|
virtual int getSection(const char *sname, int *slen=NULL);
|
||||||
|
|||||||
@ -1027,10 +1027,6 @@ PackLinuxElf32::generateElfHdr(
|
|||||||
h2->ehdr.e_shnum = 0;
|
h2->ehdr.e_shnum = 0;
|
||||||
h2->ehdr.e_shstrndx = 0;
|
h2->ehdr.e_shstrndx = 0;
|
||||||
|
|
||||||
#if 0 //{
|
|
||||||
unsigned identsize;
|
|
||||||
char const *const ident = getIdentstr(&identsize);
|
|
||||||
#endif //}
|
|
||||||
sz_elf_hdrs = sizeof(*h2) - sizeof(linfo); // default
|
sz_elf_hdrs = sizeof(*h2) - sizeof(linfo); // default
|
||||||
set_native32(&h2->phdr[0].p_filesz, sizeof(*h2)); // + identsize;
|
set_native32(&h2->phdr[0].p_filesz, sizeof(*h2)); // + identsize;
|
||||||
h2->phdr[0].p_memsz = h2->phdr[0].p_filesz;
|
h2->phdr[0].p_memsz = h2->phdr[0].p_filesz;
|
||||||
@ -1081,10 +1077,6 @@ PackOpenBSDElf32x86::generateElfHdr(
|
|||||||
h3->ehdr.e_shnum = 0;
|
h3->ehdr.e_shnum = 0;
|
||||||
h3->ehdr.e_shstrndx = 0;
|
h3->ehdr.e_shstrndx = 0;
|
||||||
|
|
||||||
#if 0 //{
|
|
||||||
unsigned identsize;
|
|
||||||
char const *const ident = getIdentstr(&identsize);
|
|
||||||
#endif //}
|
|
||||||
sz_elf_hdrs = sizeof(*h3) - sizeof(linfo);
|
sz_elf_hdrs = sizeof(*h3) - sizeof(linfo);
|
||||||
unsigned const note_offset = sz_elf_hdrs;
|
unsigned const note_offset = sz_elf_hdrs;
|
||||||
set_native32(&h3->phdr[0].p_filesz, sizeof(*h3)+sizeof(elfnote)); // + identsize;
|
set_native32(&h3->phdr[0].p_filesz, sizeof(*h3)+sizeof(elfnote)); // + identsize;
|
||||||
@ -1147,10 +1139,6 @@ PackLinuxElf64::generateElfHdr(
|
|||||||
h2->ehdr.e_shnum = 0;
|
h2->ehdr.e_shnum = 0;
|
||||||
h2->ehdr.e_shstrndx = 0;
|
h2->ehdr.e_shstrndx = 0;
|
||||||
|
|
||||||
#if 0 //{
|
|
||||||
unsigned identsize;
|
|
||||||
char const *const ident = getIdentstr(&identsize);
|
|
||||||
#endif //}
|
|
||||||
sz_elf_hdrs = sizeof(*h2) - sizeof(linfo); // default
|
sz_elf_hdrs = sizeof(*h2) - sizeof(linfo); // default
|
||||||
set_native64(&h2->phdr[0].p_filesz, sizeof(*h2)); // + identsize;
|
set_native64(&h2->phdr[0].p_filesz, sizeof(*h2)); // + identsize;
|
||||||
h2->phdr[0].p_memsz = h2->phdr[0].p_filesz;
|
h2->phdr[0].p_memsz = h2->phdr[0].p_filesz;
|
||||||
|
|||||||
@ -136,10 +136,6 @@ PackLinuxI386::generateElfHdr(
|
|||||||
assert(h2->ehdr.e_phentsize == sizeof(Elf32_Phdr));
|
assert(h2->ehdr.e_phentsize == sizeof(Elf32_Phdr));
|
||||||
assert(h2->ehdr.e_shnum == 0);
|
assert(h2->ehdr.e_shnum == 0);
|
||||||
|
|
||||||
#if 0 //{
|
|
||||||
unsigned identsize;
|
|
||||||
char const *const ident = getIdentstr(&identsize);
|
|
||||||
#endif //}
|
|
||||||
h2->phdr[0].p_filesz = sizeof(*h2); // + identsize;
|
h2->phdr[0].p_filesz = sizeof(*h2); // + identsize;
|
||||||
h2->phdr[0].p_memsz = h2->phdr[0].p_filesz;
|
h2->phdr[0].p_memsz = h2->phdr[0].p_filesz;
|
||||||
|
|
||||||
|
|||||||
@ -633,11 +633,6 @@ void PackTos::pack(OutputFile *fo)
|
|||||||
memcpy(obuf+d_off, getLoader() + e_len, d_len);
|
memcpy(obuf+d_off, getLoader() + e_len, d_len);
|
||||||
|
|
||||||
patchPackHeader(loader, o_text);
|
patchPackHeader(loader, o_text);
|
||||||
#if 0
|
|
||||||
patchVersionYear(loader, o_text);
|
|
||||||
if (!opt->small)
|
|
||||||
patchVersion(loader, o_text);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// write new file header, loader and compressed file
|
// write new file header, loader and compressed file
|
||||||
fo->write(&oh, FH_SIZE);
|
fo->write(&oh, FH_SIZE);
|
||||||
|
|||||||
@ -828,38 +828,6 @@ int Packer::patch_le32(void *b, int blen, const void *old, unsigned new_)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// patch version into stub/ident_n.ash
|
|
||||||
int Packer::patchVersion(void *b, int blen)
|
|
||||||
{
|
|
||||||
int boff = find(b, blen, "$Id: UPX UPXV ", 14);
|
|
||||||
checkPatch(b, blen, boff, 14);
|
|
||||||
|
|
||||||
unsigned char *p = (unsigned char *)b + boff + 9;
|
|
||||||
if (opt->debug.fake_stub_version[0])
|
|
||||||
memcpy(p, opt->debug.fake_stub_version, 4);
|
|
||||||
else
|
|
||||||
memcpy(p, UPX_VERSION_STRING4, 4);
|
|
||||||
|
|
||||||
return boff;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// patch year into stub/ident_[ns].ash
|
|
||||||
int Packer::patchVersionYear(void *b, int blen)
|
|
||||||
{
|
|
||||||
int boff = find(b, blen, " 1996-UPXY ", 11);
|
|
||||||
checkPatch(b, blen, boff, 11);
|
|
||||||
|
|
||||||
unsigned char *p = (unsigned char *)b + boff + 6;
|
|
||||||
if (opt->debug.fake_stub_year[0])
|
|
||||||
memcpy(p, opt->debug.fake_stub_year, 4);
|
|
||||||
else
|
|
||||||
memcpy(p, UPX_VERSION_YEAR, 4);
|
|
||||||
|
|
||||||
return boff;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// relocation util
|
// relocation util
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@ -986,7 +954,7 @@ int Packer::getLoaderSize() const
|
|||||||
// loader util
|
// loader util
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
char const *Packer::getIdentstr(unsigned *size, int small) const
|
static const char *getIdentstr(unsigned *size, int small)
|
||||||
{
|
{
|
||||||
static char identbig[] =
|
static char identbig[] =
|
||||||
"\n\0"
|
"\n\0"
|
||||||
@ -1066,7 +1034,7 @@ void __acc_cdecl_va Packer::addLoader(const char *s, ...)
|
|||||||
while (s != NULL)
|
while (s != NULL)
|
||||||
{
|
{
|
||||||
if (*s)
|
if (*s)
|
||||||
linker->addSection(s);
|
linker->addLoader(s);
|
||||||
s = va_arg(ap, const char *);
|
s = va_arg(ap, const char *);
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|||||||
@ -209,7 +209,6 @@ protected:
|
|||||||
virtual void freezeLoader();
|
virtual void freezeLoader();
|
||||||
virtual upx_byte *getLoader() const;
|
virtual upx_byte *getLoader() const;
|
||||||
virtual int getLoaderSize() const;
|
virtual int getLoaderSize() const;
|
||||||
virtual const char *getIdentstr(unsigned *size, int small=-1) const;
|
|
||||||
virtual void initLoader(const void *pdata, int plen, int small=-1);
|
virtual void initLoader(const void *pdata, int plen, int small=-1);
|
||||||
#if 1 && (ACC_CC_GNUC >= 0x040100)
|
#if 1 && (ACC_CC_GNUC >= 0x040100)
|
||||||
virtual void __acc_cdecl_va addLoader(const char *s, ...) __attribute__((__sentinel__));
|
virtual void __acc_cdecl_va addLoader(const char *s, ...) __attribute__((__sentinel__));
|
||||||
@ -259,8 +258,6 @@ protected:
|
|||||||
int patch_le16(void *b, int blen, const void * old, unsigned new_);
|
int patch_le16(void *b, int blen, const void * old, unsigned new_);
|
||||||
int patch_le32(void *b, int blen, unsigned old, unsigned new_);
|
int patch_le32(void *b, int blen, unsigned old, unsigned new_);
|
||||||
int patch_le32(void *b, int blen, const void * old, unsigned new_);
|
int patch_le32(void *b, int blen, const void * old, unsigned new_);
|
||||||
int patchVersion(void *b, int blen);
|
|
||||||
int patchVersionYear(void *b, int blen);
|
|
||||||
void checkPatch(void *b, int blen, int boff, int size);
|
void checkPatch(void *b, int blen, int boff, int size);
|
||||||
|
|
||||||
// relocation util
|
// relocation util
|
||||||
|
|||||||
@ -126,6 +126,8 @@ override T = $(basename $(notdir $@))
|
|||||||
# // setup toolchain globals
|
# // setup toolchain globals
|
||||||
# ************************************************************************/
|
# ************************************************************************/
|
||||||
|
|
||||||
|
RTRIM := sed -e 's/[ ]*$$//'
|
||||||
|
|
||||||
# default settings for $(tc_list)
|
# default settings for $(tc_list)
|
||||||
tc.default.bin2h = python $(top_srcdir)/src/stub/scripts/bin2h.py
|
tc.default.bin2h = python $(top_srcdir)/src/stub/scripts/bin2h.py
|
||||||
tc.default.brandelf = python $(top_srcdir)/src/stub/scripts/brandelf.py $(if $(tc_bfdname),--bfdname=$(tc_bfdname))
|
tc.default.brandelf = python $(top_srcdir)/src/stub/scripts/brandelf.py $(if $(tc_bfdname),--bfdname=$(tc_bfdname))
|
||||||
@ -139,7 +141,7 @@ tc.default.sstrip = sstrip
|
|||||||
tc.default.m-ld = multiarch-ld-2.17 $(if $(tc_bfdname),-b $(tc_bfdname))
|
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-nm = multiarch-nm-2.17 $(if $(tc_bfdname),--target=$(tc_bfdname))
|
||||||
tc.default.m-objcopy = multiarch-objcopy-2.17 $(if $(tc_bfdname),-F $(tc_bfdname))
|
tc.default.m-objcopy = multiarch-objcopy-2.17 $(if $(tc_bfdname),-F $(tc_bfdname))
|
||||||
tc.default.m-objdump = multiarch-objdump-2.17 $(if $(tc_bfdname),-b $(tc_bfdname))
|
tc.default.m-objdump = multiarch-objdump-2.17 $(if $(tc_bfdname),-b $(tc_bfdname)) $(if $(tc_bfdarch),-m $(tc_bfdarch))
|
||||||
tc.default.m-readelf = multiarch-readelf-2.17
|
tc.default.m-readelf = multiarch-readelf-2.17
|
||||||
|
|
||||||
# default binutils
|
# default binutils
|
||||||
@ -150,10 +152,11 @@ tc.default.objdump = $(call tc,m-objdump)
|
|||||||
tc.default.objstrip = $(call tc,objcopy) -R .comment -R .note -R .reginfo
|
tc.default.objstrip = $(call tc,objcopy) -R .comment -R .note -R .reginfo
|
||||||
|
|
||||||
define tc.default.embed_objinfo
|
define tc.default.embed_objinfo
|
||||||
|
$(call tc,m-objdump) -D $2 | $(RTRIM) > $2.disasm
|
||||||
$(call tc,m-objcopy) --strip-unneeded $2
|
$(call tc,m-objcopy) --strip-unneeded $2
|
||||||
$(call tc,m-objcopy) -R .text -R .data -R .bss $2
|
$(call tc,m-objcopy) -R .text -R .data -R .bss $2
|
||||||
$(call tc,m-objcopy) -R .comment -R .note -R .reginfo $2
|
$(call tc,m-objcopy) -R .comment -R .note -R .reginfo $2
|
||||||
$(call tc,m-objdump) -trwh $2 | sed -e 's/[ ]*$$//' > $2.dump
|
$(call tc,m-objdump) -trwh $2 | $(RTRIM) > $2.dump
|
||||||
cat $2.dump >> $2
|
cat $2.dump >> $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@ -181,6 +184,7 @@ PP_FLAGS =
|
|||||||
IDENT_NAME =
|
IDENT_NAME =
|
||||||
IDENT_PREFIX =
|
IDENT_PREFIX =
|
||||||
IDENT_SUFFIX =
|
IDENT_SUFFIX =
|
||||||
|
tc_bfdarch =
|
||||||
tc_bfdname =
|
tc_bfdname =
|
||||||
tc_list =
|
tc_list =
|
||||||
|
|
||||||
@ -222,7 +226,7 @@ tmp/amd64-linux.elf-main.o : $(srcdir)/src/$$T.c
|
|||||||
arm-linux.elf% : tc_list = arm-linux.elf default
|
arm-linux.elf% : tc_list = arm-linux.elf default
|
||||||
arm-linux.elf% : tc_bfdname = elf32-littlearm
|
arm-linux.elf% : tc_bfdname = elf32-littlearm
|
||||||
|
|
||||||
tc.arm-linux.elf.gcc = arm-linux-gcc-4.1.0 -march=armv4 -nostdinc -MMD -MT $@
|
tc.arm-linux.elf.gcc = arm-linux-gcc-4.1.0 -mlittle-endian -march=armv4 -nostdinc -MMD -MT $@
|
||||||
tc.arm-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
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
|
tc.arm-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||||
|
|
||||||
@ -265,26 +269,12 @@ arm.v4t-wince.pe% : tc_bfdname = elf32-littlearm
|
|||||||
|
|
||||||
arm.v4a-wince.pe.h : $(srcdir)/src/$$T.S
|
arm.v4a-wince.pe.h : $(srcdir)/src/$$T.S
|
||||||
$(call tc,gcc) -march=armv4 -c $< -o tmp/$T.bin
|
$(call tc,gcc) -march=armv4 -c $< -o tmp/$T.bin
|
||||||
ifeq (1,1)
|
|
||||||
$(call tc,m-objcopy) -R .text -R .data -R .bss tmp/$T.bin
|
|
||||||
$(call tc,m-objcopy) -R .note -R .comment tmp/$T.bin
|
|
||||||
$(call tc,m-objdump) -trwh tmp/$T.bin >> tmp/$T.bin
|
|
||||||
else
|
|
||||||
# FIXME: can we use --strip-unneeded on arm ??
|
|
||||||
$(call tc,embed_objinfo,tmp/$T.bin)
|
$(call tc,embed_objinfo,tmp/$T.bin)
|
||||||
endif
|
|
||||||
$(call tc,bin2h) --ident=nrv_loader_arm tmp/$T.bin $@
|
$(call tc,bin2h) --ident=nrv_loader_arm tmp/$T.bin $@
|
||||||
|
|
||||||
arm.v4t-wince.pe.h : $(srcdir)/src/$$T.S
|
arm.v4t-wince.pe.h : $(srcdir)/src/$$T.S
|
||||||
$(call tc,gcc) -march=armv4t -c $< -o tmp/$T.bin
|
$(call tc,gcc) -march=armv4t -c $< -o tmp/$T.bin
|
||||||
ifeq (1,1)
|
|
||||||
$(call tc,m-objcopy) -R .text -R .data -R .bss tmp/$T.bin
|
|
||||||
$(call tc,m-objcopy) -R .note -R .comment tmp/$T.bin
|
|
||||||
$(call tc,m-objdump) -trwh tmp/$T.bin >> tmp/$T.bin
|
|
||||||
else
|
|
||||||
# FIXME: can we use --strip-unneeded on arm ??
|
|
||||||
$(call tc,embed_objinfo,tmp/$T.bin)
|
$(call tc,embed_objinfo,tmp/$T.bin)
|
||||||
endif
|
|
||||||
$(call tc,bin2h) --ident=nrv_loader_thumb tmp/$T.bin $@
|
$(call tc,bin2h) --ident=nrv_loader_thumb tmp/$T.bin $@
|
||||||
|
|
||||||
|
|
||||||
@ -293,6 +283,7 @@ endif
|
|||||||
# ************************************************************************/
|
# ************************************************************************/
|
||||||
|
|
||||||
i086-dos16.com% : tc_list = arch-i086 default
|
i086-dos16.com% : tc_list = arch-i086 default
|
||||||
|
i086-dos16.com% : tc_bfdarch = i8086
|
||||||
|
|
||||||
i086-dos16.com.h : $(srcdir)/src/$$T.S
|
i086-dos16.com.h : $(srcdir)/src/$$T.S
|
||||||
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||||
@ -305,6 +296,7 @@ i086-dos16.com.h : $(srcdir)/src/$$T.S
|
|||||||
# ************************************************************************/
|
# ************************************************************************/
|
||||||
|
|
||||||
i086-dos16.exe% : tc_list = arch-i086 default
|
i086-dos16.exe% : tc_list = arch-i086 default
|
||||||
|
i086-dos16.exe% : tc_bfdarch = i8086
|
||||||
|
|
||||||
i086-dos16.exe.h : $(srcdir)/src/$$T.S
|
i086-dos16.exe.h : $(srcdir)/src/$$T.S
|
||||||
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||||
@ -317,6 +309,7 @@ i086-dos16.exe.h : $(srcdir)/src/$$T.S
|
|||||||
# ************************************************************************/
|
# ************************************************************************/
|
||||||
|
|
||||||
i086-dos16.sys% : tc_list = arch-i086 default
|
i086-dos16.sys% : tc_list = arch-i086 default
|
||||||
|
i086-dos16.sys% : tc_bfdarch = i8086
|
||||||
|
|
||||||
i086-dos16.sys.h : $(srcdir)/src/$$T.S
|
i086-dos16.sys.h : $(srcdir)/src/$$T.S
|
||||||
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.bin
|
||||||
@ -606,19 +599,12 @@ i386-win32.pe.h : $(srcdir)/src/$$T.S
|
|||||||
m68k-atari.tos-%.h : tc_list = m68k-atari.tos default
|
m68k-atari.tos-%.h : tc_list = m68k-atari.tos default
|
||||||
m68k-atari.tos-%.h : tc_bfdname = elf32-m68k
|
m68k-atari.tos-%.h : tc_bfdname = elf32-m68k
|
||||||
|
|
||||||
tc.m68k-atari.tos.as = m68k-linux-as-20060406 --register-prefix-optional
|
tc.m68k-atari.tos.gcc = m68k-linux-gcc-4.1.1 -m68000 -malign-int -nostdinc -MMD -MT $@
|
||||||
tc.m68k-atari.tos.gcc = m68k-linux-gcc-4.1.1 -nostdinc -MMD -MT $@
|
|
||||||
tc.m68k-atari.tos.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
tc.m68k-atari.tos.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||||
tc.m68k-atari.tos.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
tc.m68k-atari.tos.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||||
|
|
||||||
m68k-atari.tos-nrv%.h : $(srcdir)/src/m68k-atari.tos.S
|
m68k-atari.tos-nrv%.h : $(srcdir)/src/m68k-atari.tos.S
|
||||||
ifeq (1,2)
|
|
||||||
$(call tc,pp-as) -D__GAS__ $(PP_FLAGS) $< -o tmp/$T.i
|
|
||||||
$(call tc,as) tmp/$T.i -o tmp/$T.bin
|
|
||||||
$(call tc,gpp_mkdep) --mode=c --MMD=$@ $< --MF=tmp/$T.d
|
|
||||||
else
|
|
||||||
$(call tc,gcc) -c -D__GAS__ $(PP_FLAGS) -x assembler-with-cpp -Wa,--register-prefix-optional $< -o tmp/$T.bin
|
$(call tc,gcc) -c -D__GAS__ $(PP_FLAGS) -x assembler-with-cpp -Wa,--register-prefix-optional $< -o tmp/$T.bin
|
||||||
endif
|
|
||||||
$(call tc,embed_objinfo,tmp/$T.bin)
|
$(call tc,embed_objinfo,tmp/$T.bin)
|
||||||
$(call tc,bin2h) --ident=$(IDENT_PREFIX)loader$(IDENT_SUFFIX) tmp/$T.bin $@
|
$(call tc,bin2h) --ident=$(IDENT_PREFIX)loader$(IDENT_SUFFIX) tmp/$T.bin $@
|
||||||
|
|
||||||
@ -647,8 +633,8 @@ tc.mipsel.r3000-ps1.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -We
|
|||||||
|
|
||||||
mipsel.r3000-ps1.h : $(srcdir)/src/$$T.S
|
mipsel.r3000-ps1.h : $(srcdir)/src/$$T.S
|
||||||
ifeq (1,1)
|
ifeq (1,1)
|
||||||
$(call tc,pp-as) $(PP_FLAGS) $< -o tmp/$T.tmp1
|
$(call tc,pp-as) $(PP_FLAGS) $< -o tmp/$T.i
|
||||||
$(call tc,as) tmp/$T.tmp1 -o tmp/$T.bin
|
$(call tc,as) tmp/$T.i -o tmp/$T.bin
|
||||||
$(call tc,gpp_mkdep) --mode=c --MMD=$@ $< --MF=tmp/$T.d
|
$(call tc,gpp_mkdep) --mode=c --MMD=$@ $< --MF=tmp/$T.d
|
||||||
else
|
else
|
||||||
## FIXME - as-2.16.1 does not work ???
|
## FIXME - as-2.16.1 does not work ???
|
||||||
@ -694,7 +680,7 @@ tmp/powerpc-darwin.macho-main.o : $(srcdir)/src/$$T.c
|
|||||||
powerpc-linux.elf% : tc_list = powerpc-linux.elf default
|
powerpc-linux.elf% : tc_list = powerpc-linux.elf default
|
||||||
powerpc-linux.elf% : tc_bfdname = elf32-powerpc
|
powerpc-linux.elf% : tc_bfdname = elf32-powerpc
|
||||||
|
|
||||||
tc.powerpc-linux.elf.gcc = powerpc.405-linux-gcc-3.4.5 -mcpu=405 -nostdinc -MMD -MT $@
|
tc.powerpc-linux.elf.gcc = powerpc.405-linux-gcc-3.4.5 -m32 -mbig-endian -mcpu=405 -nostdinc -MMD -MT $@
|
||||||
tc.powerpc-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
tc.powerpc-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||||
tc.powerpc-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
tc.powerpc-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,7 @@ lzma_d_c%.S : lzma_d_c.c
|
|||||||
$(call tc,objstrip) tmp/$T.o
|
$(call tc,objstrip) tmp/$T.o
|
||||||
$(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
|
$(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
|
||||||
head -c-1 tmp/$T.bin > tmp/$T.out
|
head -c-1 tmp/$T.bin > tmp/$T.out
|
||||||
$(call tc,objdump) -b binary -m i386:x86-64 -D tmp/$T.out > tmp/$T.out.lst
|
$(call tc,objdump) -b binary -m i386:x86-64 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||||
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
||||||
|
|
||||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||||
|
|||||||
@ -37,7 +37,7 @@ tc.arm-lzma.gcc += -I$(top_srcdir)/src
|
|||||||
|
|
||||||
lzma_d_c%.S : lzma_d_c.c
|
lzma_d_c%.S : lzma_d_c.c
|
||||||
$(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s
|
$(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s
|
||||||
sed -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' < tmp/$T.s > $@
|
sed -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' tmp/$T.s | $(RTRIM) > $@
|
||||||
|
|
||||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||||
|
|||||||
@ -35,7 +35,7 @@ tc.arm-lzma.gcc += -I$(top_srcdir)/src
|
|||||||
|
|
||||||
lzma_d_c%.S : lzma_d_c.c
|
lzma_d_c%.S : lzma_d_c.c
|
||||||
$(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s
|
$(call tc,gcc) $(PP_FLAGS) -S $< -o tmp/$T.s
|
||||||
sed -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' < tmp/$T.s > $@
|
sed -e '1,/LzmaDecode:/d' -e '/\.size/d' -e '/\.ident/d' -e 's/\.L/$(LABEL_PREFIX)/g' tmp/$T.s | $(RTRIM) > $@
|
||||||
|
|
||||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||||
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
lzma_d_cs.% : PP_FLAGS = -DSMALL
|
||||||
|
|||||||
@ -36,7 +36,7 @@ lzma_d_c%.S : lzma_d_c.c
|
|||||||
$(call tc,objstrip) tmp/$T.o
|
$(call tc,objstrip) tmp/$T.o
|
||||||
$(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
|
$(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
|
||||||
head -c-1 tmp/$T.bin > tmp/$T.out
|
head -c-1 tmp/$T.bin > tmp/$T.out
|
||||||
$(call tc,objdump) -b binary -m i386 -D tmp/$T.out > tmp/$T.out.lst
|
$(call tc,objdump) -b binary -m i386 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||||
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
||||||
|
|
||||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||||
|
|||||||
@ -38,7 +38,7 @@ lzma_d_c%.S : lzma_d_c.c
|
|||||||
$(call tc,objstrip) tmp/$T.o
|
$(call tc,objstrip) tmp/$T.o
|
||||||
$(call tc,m-objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
|
$(call tc,m-objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
|
||||||
head -c-0 tmp/$T.bin > tmp/$T.out
|
head -c-0 tmp/$T.bin > tmp/$T.out
|
||||||
$(call tc,m-objdump) -b binary -m mips:3000 -D tmp/$T.out > tmp/$T.out.lst
|
$(call tc,m-objdump) -b binary -m mips:3000 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||||
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
||||||
|
|
||||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||||
|
|||||||
@ -38,7 +38,7 @@ lzma_d_c%.S : lzma_d_c.c
|
|||||||
$(call tc,objstrip) tmp/$T.o
|
$(call tc,objstrip) tmp/$T.o
|
||||||
$(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
|
$(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
|
||||||
head -c-4 tmp/$T.bin > tmp/$T.out
|
head -c-4 tmp/$T.bin > tmp/$T.out
|
||||||
$(call tc,objdump) -b binary -m powerpc -D tmp/$T.out > tmp/$T.out.lst
|
$(call tc,objdump) -b binary -m powerpc -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
|
||||||
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
$(call tc,bin2h) --mode=gas tmp/$T.out $@
|
||||||
|
|
||||||
lzma_d_cf.% : PP_FLAGS = -DFAST
|
lzma_d_cf.% : PP_FLAGS = -DFAST
|
||||||
|
|||||||
@ -55,6 +55,18 @@
|
|||||||
|
|
||||||
#define section .section
|
#define section .section
|
||||||
|
|
||||||
|
// p_armpe.cpp uses the following symbols, so they should be global
|
||||||
|
|
||||||
|
.globl SRC0
|
||||||
|
.globl DST0
|
||||||
|
.globl IATT
|
||||||
|
.globl ENTR
|
||||||
|
.globl FIBS
|
||||||
|
.globl FIBE
|
||||||
|
.globl BREL
|
||||||
|
.globl BIMP
|
||||||
|
.globl ONAM
|
||||||
|
|
||||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
.arm
|
.arm
|
||||||
|
|||||||
@ -29,6 +29,11 @@
|
|||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// p_armpe.cpp uses some symbols, so they should be global
|
||||||
|
// in thumb mode we need this S() macro hack to export a symbol which
|
||||||
|
// is used in an ldr statement
|
||||||
|
#define S(sym) .globl sym; sym: .L##sym
|
||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
|
|
||||||
#define section .section
|
#define section .section
|
||||||
@ -65,12 +70,12 @@ section ExeStart
|
|||||||
ldr ip, ENTR
|
ldr ip, ENTR
|
||||||
bx ip
|
bx ip
|
||||||
|
|
||||||
SRC0: .long start_of_compressed
|
S(SRC0):.long start_of_compressed
|
||||||
SRCL: .long compressed_length
|
SRCL: .long compressed_length
|
||||||
DST0: .long start_of_uncompressed
|
S(DST0):.long start_of_uncompressed
|
||||||
DSTL: .long uncompressed_length
|
DSTL: .long uncompressed_length
|
||||||
IATT: .long 0, 0, 0, 0
|
S(IATT):.long 0, 0, 0, 0
|
||||||
ENTR: .long original_entry
|
S(ENTR):.long original_entry
|
||||||
|
|
||||||
.thumb
|
.thumb
|
||||||
|
|
||||||
@ -89,9 +94,9 @@ section Unfilter_0x50
|
|||||||
addval .req r2
|
addval .req r2
|
||||||
bufend .req r4
|
bufend .req r4
|
||||||
|
|
||||||
ldr buffer, FIBS
|
ldr buffer, .LFIBS
|
||||||
mov addval, #0
|
mov addval, #0
|
||||||
ldr bufend, FIBE
|
ldr bufend, .LFIBE
|
||||||
mov r5, #0x0f
|
mov r5, #0x0f
|
||||||
mov r6, #0xff
|
mov r6, #0xff
|
||||||
lsl r6, #24
|
lsl r6, #24
|
||||||
@ -122,8 +127,8 @@ section Unfilter_0x50
|
|||||||
.unreq bufend
|
.unreq bufend
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
FIBS: .long filter_buffer_start
|
S(FIBS):.long filter_buffer_start
|
||||||
FIBE: .long filter_buffer_end
|
S(FIBE):.long filter_buffer_end
|
||||||
|
|
||||||
.Luf50_ret:
|
.Luf50_ret:
|
||||||
|
|
||||||
@ -134,7 +139,7 @@ section Relocs
|
|||||||
dest .req r1
|
dest .req r1
|
||||||
addval .req r2
|
addval .req r2
|
||||||
|
|
||||||
ldr buffer, BREL
|
ldr buffer, .LBREL
|
||||||
mov addval, dst0
|
mov addval, dst0
|
||||||
sub dest, addval, #4
|
sub dest, addval, #4
|
||||||
|
|
||||||
@ -173,7 +178,7 @@ section Relocs
|
|||||||
b .Lreloc_loop
|
b .Lreloc_loop
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
BREL: .long start_of_relocs
|
S(BREL):.long start_of_relocs
|
||||||
|
|
||||||
.Lreloc_end:
|
.Lreloc_end:
|
||||||
|
|
||||||
@ -190,13 +195,13 @@ section Imports
|
|||||||
sub sp, #508
|
sub sp, #508
|
||||||
sub sp, #508
|
sub sp, #508
|
||||||
sub sp, #508
|
sub sp, #508
|
||||||
ldr imp, BIMP
|
ldr imp, .LBIMP
|
||||||
.Lhi_loop1:
|
.Lhi_loop1:
|
||||||
mov r0, imp
|
mov r0, imp
|
||||||
bl get_le32
|
bl get_le32
|
||||||
beq .Lhi_end
|
beq .Lhi_end
|
||||||
|
|
||||||
ldr r1, ONAM
|
ldr r1, .LONAM
|
||||||
add r0, r1
|
add r0, r1
|
||||||
mov r1, sp
|
mov r1, sp
|
||||||
.Lhi_copyname:
|
.Lhi_copyname:
|
||||||
@ -265,8 +270,8 @@ LoadLibraryW:
|
|||||||
GetProcAddressA:
|
GetProcAddressA:
|
||||||
bx r11
|
bx r11
|
||||||
|
|
||||||
BIMP: .long start_of_imports
|
S(BIMP):.long start_of_imports
|
||||||
ONAM: .long start_of_dll_names
|
S(ONAM):.long start_of_dll_names
|
||||||
|
|
||||||
.Lhi_end:
|
.Lhi_end:
|
||||||
mov sp, r7
|
mov sp, r7
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user