mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Minor cleanups.
This commit is contained in:
parent
7f5635ea8c
commit
255781c029
|
@ -82,7 +82,7 @@ endif
|
|||
ifndef default.targets
|
||||
ifeq ($(wildcard .all-stamp),)
|
||||
default.targets =
|
||||
default: $$(default.targets)
|
||||
default:
|
||||
@echo "UPX info: type 'make all' if you have all the required build tools."
|
||||
else
|
||||
default.targets = all
|
||||
|
@ -423,7 +423,7 @@ i386-linux.elf% : tc_bfdname = elf32-i386
|
|||
tc.i386-linux.elf.gcc = i386-linux-gcc-3.4.6 -m32 -march=i386 -nostdinc -MMD
|
||||
tc.i386-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
|
||||
tc.i386-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wwrite-strings -Werror
|
||||
tc.i386-linux.elf.gcc += -march=i386 -mtune=k6
|
||||
tc.i386-linux.elf.gcc += -mtune=k6
|
||||
tc.i386-linux.elf.gcc += -Os -fno-omit-frame-pointer
|
||||
tc.i386-linux.elf.gcc += -momit-leaf-frame-pointer
|
||||
tc.i386-linux.elf.gcc += -fno-align-functions -fno-align-jumps -fno-align-labels -fno-align-loops
|
||||
|
@ -553,9 +553,9 @@ tmp/i386-linux.elf.shell-main.o : $(srcdir)/src/$$T.c
|
|||
# // i386-linux.kernel.vmlinuz
|
||||
# ************************************************************************/
|
||||
|
||||
i386-linux.kernel.vmlin% : tc_list = arch-i386 default
|
||||
i386-linux.kernel.vmlinu% : tc_list = arch-i386 default
|
||||
|
||||
i386-linux.kernel%.h : $(srcdir)/src/$$T.S
|
||||
i386-linux.kernel.vmlinu%.h : $(srcdir)/src/$$T.S
|
||||
$(call tc,gcc) -c -x assembler-with-cpp $< -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
|
||||
|
@ -618,7 +618,7 @@ m68k-atari.tos-nrv2%.small.h : IDENT_SUFFIX = _small
|
|||
|
||||
|
||||
# /***********************************************************************
|
||||
# // mipsel.r3000-ps1.exe
|
||||
# // mipsel.r3000-ps1
|
||||
# ************************************************************************/
|
||||
|
||||
mipsel.r3000-ps1.h : tc_list = mipsel.r3000-ps1 default
|
||||
|
@ -650,6 +650,35 @@ mipsel.r3000-ps1.h: PP_FLAGS += -DPS1
|
|||
mipsel.r3000-ps1.h: IDENT_NAME = nrv_loader
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // powerpc-darwin.macho
|
||||
# ************************************************************************/
|
||||
|
||||
# info: we use the tc settings from powerpc-linux.elf
|
||||
powerpc-darwin.macho% : tc_list = powerpc-linux.elf default
|
||||
powerpc-darwin.macho% : tc_bfdname = elf32-powerpc
|
||||
|
||||
powerpc-darwin.macho-entry.h : $(srcdir)/src/$$T.S
|
||||
$(call tc,gcc) -c $< -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
|
||||
$(call tc,m-objdump) -trwh tmp/$T.bin >> tmp/$T.bin
|
||||
$(call tc,bin2h) --ident=l_mac_ppc32_loader tmp/$T.bin $@
|
||||
|
||||
powerpc-darwin.macho-fold.h : tmp/$$T.o tmp/powerpc-darwin.macho-main.o
|
||||
$(call tc,ld) --oformat binary -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^)
|
||||
$(call tc,bin2h) --ident=fold_machppc32 tmp/$T.bin $@
|
||||
|
||||
tmp/powerpc-darwin.macho-fold.o : $(srcdir)/src/$$T.S
|
||||
$(call tc,gcc) -c $< -o $@
|
||||
$(call tc,objstrip) $@
|
||||
|
||||
tmp/powerpc-darwin.macho-main.o : $(srcdir)/src/$$T.c
|
||||
$(call tc,gcc) -c -Os $< -o $@
|
||||
$(call tc,objstrip) $@
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // powerpc-linux.elf
|
||||
# ************************************************************************/
|
||||
|
@ -683,41 +712,12 @@ tmp/powerpc-linux.elf-main.o : $(srcdir)/src/$$T.c
|
|||
$(call tc,objstrip) $@
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // powerpc-darwin.macho
|
||||
# ************************************************************************/
|
||||
|
||||
# info: we use the tc settings from powerpc-linux.elf
|
||||
powerpc-darwin.macho% : tc_list = powerpc-linux.elf default
|
||||
powerpc-darwin.macho% : tc_bfdname = elf32-powerpc
|
||||
|
||||
powerpc-darwin.macho-entry.h : $(srcdir)/src/$$T.S
|
||||
$(call tc,gcc) -c $< -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
|
||||
$(call tc,m-objdump) -trwh tmp/$T.bin >> tmp/$T.bin
|
||||
$(call tc,bin2h) --ident=l_mac_ppc32_loader tmp/$T.bin $@
|
||||
|
||||
powerpc-darwin.macho-fold.h : tmp/$$T.o tmp/powerpc-darwin.macho-main.o
|
||||
$(call tc,ld) --oformat binary -Map tmp/$T.map -o tmp/$T.bin --strip-all $(filter %.o,$^)
|
||||
$(call tc,bin2h) --ident=fold_machppc32 tmp/$T.bin $@
|
||||
|
||||
tmp/powerpc-darwin.macho-fold.o : $(srcdir)/src/$$T.S
|
||||
$(call tc,gcc) -c $< -o $@
|
||||
$(call tc,objstrip) $@
|
||||
|
||||
tmp/powerpc-darwin.macho-main.o : $(srcdir)/src/$$T.c
|
||||
$(call tc,gcc) -c -Os $< -o $@
|
||||
$(call tc,objstrip) $@
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // dependencies
|
||||
# ************************************************************************/
|
||||
|
||||
ifneq ($(STUBS),)
|
||||
# FIXME: we want a dependency-only-prerequisite here
|
||||
# FIXME: we want a dependency-only prerequisite here
|
||||
##$(STUBS): | tmp/.tmp-stamp
|
||||
##$(STUBS): $(MAKEFILE_LIST)
|
||||
endif
|
||||
|
|
|
@ -38,6 +38,10 @@ class opts:
|
|||
verbose = 0
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // write header
|
||||
# ************************************************************************/
|
||||
|
||||
def w_header_c(w, ifile, ofile, n):
|
||||
w("/* %s -- created from %s, %d (0x%x) bytes\n" % (os.path.basename(ofile), os.path.basename(ifile), n, n))
|
||||
w("""\n\
|
||||
|
@ -68,6 +72,10 @@ def w_header_c(w, ifile, ofile, n):
|
|||
*/\n\n\n""")
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // write data
|
||||
# ************************************************************************/
|
||||
|
||||
def w_checksum_c(w, s, data):
|
||||
w("#define %s_SIZE %d\n" % (s, len(data)))
|
||||
w("#define %s_ADLER32 0x%08x\n" % (s, 0xffffffffL & zlib.adler32(data)))
|
||||
|
@ -89,8 +97,8 @@ def w_data_c(w, data):
|
|||
w(", " [i == n - 1])
|
||||
i = n
|
||||
while i % 16 != 0:
|
||||
i += 1
|
||||
w(" ")
|
||||
i += 1
|
||||
w_eol(w, i)
|
||||
|
||||
|
||||
|
@ -110,8 +118,8 @@ def w_data_gas(w, data):
|
|||
w("%3d" % ord(data[i]))
|
||||
i = n
|
||||
while i % 16 != 0:
|
||||
i += 1
|
||||
w(" ")
|
||||
i += 1
|
||||
w_eol(w, i)
|
||||
|
||||
|
||||
|
@ -131,11 +139,15 @@ def w_data_nasm(w, data):
|
|||
w("%3d" % ord(data[i]))
|
||||
i = n
|
||||
while i % 16 != 0:
|
||||
i += 1
|
||||
w(" ")
|
||||
i += 1
|
||||
w_eol(w, i)
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# // main
|
||||
# ************************************************************************/
|
||||
|
||||
def main(argv):
|
||||
shortopts, longopts = "qv", ["dry-run", "ident=", "mode=", "quiet", "verbose"]
|
||||
xopts, args = getopt.gnu_getopt(argv[1:], shortopts, longopts)
|
||||
|
@ -159,8 +171,6 @@ def main(argv):
|
|||
sys.exit(1)
|
||||
if 1 and st.st_size > 64*1024:
|
||||
print >> sys.stderr, "%s: ERROR: file is too big (%d bytes)" % (ifile, st.st_size)
|
||||
if re.search(r"^fold", ifile):
|
||||
print >> sys.stderr, " (please upgrade your binutils to 2.12.90.0.15 or better)"
|
||||
sys.exit(1)
|
||||
|
||||
# read ifile
|
||||
|
@ -193,7 +203,6 @@ def main(argv):
|
|||
fp.close()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ class opts:
|
|||
verbose = 0
|
||||
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
# //
|
||||
# ************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue
Block a user