diff --git a/.cvsignore b/.cvsignore index b33c6c7d..5646f6a9 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,3 +1,4 @@ +B ChangeLog.cvs* build doxygen diff --git a/NEWS b/NEWS index 9a4c84eb..b5933915 100644 --- a/NEWS +++ b/NEWS @@ -7,7 +7,7 @@ User visible changes for UPX [ WARNING: there are known bugs in the win32/pe format which cause crashes on a number of exes ] -Changes in 1.91 beta (XX Mar 2003): +Changes in 1.91 beta (XX Sep 2003): * UNSTABLE BETA VERSION - DO NOT USE EXCEPT FOR TESTING * djgpp2/coff: added support for recent binutils versions * watcom/le: don't crash on files without relocations diff --git a/src/.cvsignore b/src/.cvsignore index d77fa2ae..7c738769 100644 --- a/src/.cvsignore +++ b/src/.cvsignore @@ -13,6 +13,7 @@ GNUmakefile .gdbinit .Attic .deps +B compress_nrv.* upx upx_nrv diff --git a/src/Makefile.bld b/src/Makefile.bld index 48386c2d..8683690e 100644 --- a/src/Makefile.bld +++ b/src/Makefile.bld @@ -260,7 +260,7 @@ endif ### -### dos32 - djgpp2 +### dos32 - djgpp2 / emx ### ifeq ($(target),djgpp2) @@ -275,7 +275,16 @@ ifneq ($(strip $(wildcard $(DJDIR)/bin/cwsdstub.ex[eE])),) STUBIFY_EXE = mfxdjstubify -v -s $(DJDIR)/bin/cwsdstub.exe $@ endif endif -endif # djgpp2 +endif + +ifeq ($(target),emx) +include $(srcdir)/Makedefs.gcc +e = .exe +CXX = gcc +CFLAGS_O = -O2 +CCARCH += -mno-probe +LDFLAGS = -s +endif ### @@ -284,6 +293,7 @@ endif # djgpp2 ifeq ($(target),cygwin) include $(srcdir)/Makedefs.gcc +##CXX = g++-2 e = .exe CCARCH += -mcygwin -march=i386 -mcpu=i686 endif @@ -501,7 +511,7 @@ endif # vc ### -### win32 - Watcom C++ 11.0c / Open Watcom C++ 1.0 +### win32 - Watcom C++ ### ifeq ($(target),wc) @@ -509,6 +519,7 @@ o = .obj a = .lib e = .exe CC = wcl386 -zq -bt=nt -mf -5r +##CC = wcl386 -zq -bt=dos -l=CauseWay -mf -5r CFLAGS = -zc -w5 -we CXXFLAGS = $(CFLAGS) -xs -xr CFLAGS_OUTPUT = -fo=$@ @@ -538,6 +549,90 @@ endif endif # wc +### +### win64 - Intel C++ +### + +ifeq ($(target),win64-ic) +o = .obj +a = .lib +e = .exe +CC = ecl -nologo +CFLAGS = -W3 +CXXFLAGS = $(CFLAGS) -EHac -GR +LDFLAGS = +LINK_EXE_OUTPUT = -Fe$@ +LINK_EXE_LDFLAGS = /link /map:$T.map +##LINK_EXE_LDFLAGS += /verbose + +ifneq ($(strip $(DOS_LIBDIRS)),) +LIB := $(DOS_LIBDIRS);$(LIB) +endif +export LIB + +ifeq (1,2) + # statically link libc.lib + CC += -ML + LDLIBS = $(DOS_LDLIBS:.lib=_ml.lib) setargv.obj +else + # link against msvcrt.dll + CC += -MD + LDLIBS = $(DOS_LDLIBS) setargv.obj +endif +ifeq ($(DEBUG),1) + CFLAGS += -Od -ZI + LINK_EXE_LDFLAGS += /debug +else + CFLAGS += -O1 -GF + LINK_EXE_LDFLAGS += /release +endif +RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc))) + +endif # win64-ic + + +### +### win64 - Visual C++ +### + +ifeq ($(target),win64-vc) +o = .obj +a = .lib +e = .exe +CC = cl -nologo +CFLAGS = -W4 +CXXFLAGS = $(CFLAGS) -EHac -GR +LDFLAGS = +LINK_EXE_OUTPUT = -Fe$@ +LINK_EXE_LDFLAGS = /link /map:$T.map +##LINK_EXE_LDFLAGS += /verbose + +ifneq ($(strip $(DOS_LIBDIRS)),) +LIB := $(DOS_LIBDIRS);$(LIB) +endif +export LIB + +ifeq (1,1) + # statically link libc.lib + CC += -ML + LDLIBS = $(DOS_LDLIBS:.lib=_ml.lib) setargv.obj +else + # link against msvcrt.dll + CC += -MD + LDLIBS = $(DOS_LDLIBS) setargv.obj +endif +ifeq ($(DEBUG),1) + CFLAGS += -Od -ZI + LINK_EXE_LDFLAGS += /debug +else + CFLAGS += -O1 -GF + LINK_EXE_LDFLAGS += /release +endif +RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc))) + +endif # win64-vc + + # /*********************************************************************** # // malloc debuggers and memory checkers - somewhat obsolete, use valgrind # ************************************************************************/ diff --git a/src/conf.h b/src/conf.h index 29afb1b0..1fbb2d97 100644 --- a/src/conf.h +++ b/src/conf.h @@ -43,9 +43,6 @@ #include "acc/acc_incd.h" #include "acc/acc_ince.h" #include "acc/acc_lib.h" -#if !defined(acc_int64l_t) || !defined(acc_uint64l_t) -# error "need a 64-bit integer type" -#endif #if (ACC_OS_WIN32 || ACC_OS_WIN64) # if defined(INVALID_HANDLE_VALUE) || defined(MAKEWORD) || defined(RT_CURSOR) # error "something pulled in " @@ -54,8 +51,8 @@ #if (ACC_CC_BORLANDC) -# if (__BORLANDC__ < 0x0520) -# error "need Borland C++ 5.02 or newer" +# if (__BORLANDC__ < 0x0500) +# error "need Borland C++ 5.0 or newer" # endif # pragma warn -aus // 8004: 'x' is assigned a value that is never used # pragma warn -inl // 8026+8027: Function not expanded inline diff --git a/src/main.cpp b/src/main.cpp index a246530b..14be0b44 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1018,7 +1018,6 @@ void upx_sanity_check(void) COMPILE_TIME_ASSERT(sizeof(int) == 4) COMPILE_TIME_ASSERT(sizeof(long) >= 4) COMPILE_TIME_ASSERT(sizeof(void *) >= 4) - COMPILE_TIME_ASSERT(sizeof(long) >= sizeof(void *)) COMPILE_TIME_ASSERT(sizeof(off_t) >= sizeof(long)) COMPILE_TIME_ASSERT(((off_t) -1) < 0) diff --git a/src/p_lx_sh.cpp b/src/p_lx_sh.cpp index ff7b48c2..aa0fde41 100644 --- a/src/p_lx_sh.cpp +++ b/src/p_lx_sh.cpp @@ -92,7 +92,7 @@ void PackLinuxI386sh::patchLoader() { } bool PackLinuxI386sh::getShellName(char *buf) { exetype = -1; - l_shname = strcspn(buf, " \t\n\v\f\r"); + l_shname = (int) strcspn(buf, " \t\n\v\f\r"); buf[l_shname] = 0; static char const *const shname[] = { // known shells that accept "-c" arg "ash", "bash", "bsh", "csh", "ksh", "pdksh", "sh", "tcsh", "zsh", diff --git a/src/packer.cpp b/src/packer.cpp index e581a341..5548c708 100644 --- a/src/packer.cpp +++ b/src/packer.cpp @@ -910,7 +910,7 @@ unsigned Packer::unoptimizeReloc32(upx_byte **in, upx_byte *image, } //fprintf(stderr,"relocnum=%x\n",relocn); *in = p+1; - return relocs - outp; + return (unsigned) (relocs - outp); } diff --git a/src/snprintf.cpp b/src/snprintf.cpp index 38e672f7..952a417f 100644 --- a/src/snprintf.cpp +++ b/src/snprintf.cpp @@ -710,7 +710,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args break; case 'p': strvalue = (const char *) va_arg (args, const void *); - fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); + fmtint (buffer, &currlen, maxlen, (LLONG) (acc_uintptr_t) strvalue, 16, min, max, flags); break; case 'n': if (cflags == DP_C_SHORT) { diff --git a/src/util.cpp b/src/util.cpp index bf869959..c4337e68 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -538,7 +538,15 @@ unsigned get_ratio(unsigned u_len, unsigned c_len) const unsigned n = 1000000; if (u_len <= 0) return c_len <= 0 ? 0 : n; +#if defined(acc_uint64l_t) return (unsigned) ((c_len * (acc_uint64l_t)n) / u_len); +#else +# if 0 + return (unsigned) acc_umuldiv32(c_len, n, u_len); +# else + return (unsigned) ((c_len * (double)n) / u_len); +# endif +#endif }