diff --git a/BUGS b/BUGS index 7195f730..e2e49fa9 100644 --- a/BUGS +++ b/BUGS @@ -13,8 +13,12 @@ http://upx.tsx.org -Things not (yet) supported: -=========================== +Limitations and other things which are not (yet) supported: +=========================================================== + +djgpp2/coff +----------- + * all overlays (except Allegro pakfiles) are silently stripped dos/exe ------- @@ -22,30 +26,27 @@ dos/exe * max ~24000 relocation records (...should be enough for everyone ;-) * exe + sys combined images -wc/le ------ +watcom/le +--------- * 16-bit selector alias fixups - * 16-bit offset relocation for objects larger than 4 kbyte + * 16-bit offset relocation for objects larger than 4 kB * 16:16 fixups -If you need any of the above (they're very rare), send us an url of a +If you need any of the above (they're very rare), send us an URL of a test file. * 16-bit objects are not loaded into DOS memory * There is still a problem with the wdosx extender: if you compress a - wc/le file which does NOT contain the wdosx extender, and after this + watcom/le file which does NOT contain the wdosx extender, and after this you bind the wdosx stub to the compressed file, then it will work. Otherwise it won't. * unpacked pmwlite compressed programs might not work when compressed - with upx (pmwunlite bug mainly :-) + with UPX (this is a bug in pmwunlite) win32/pe -------- * writeable shared sections (`--force' *may* work) * certificates in the image - * compressing files containing big BSS requires lots of memory - -djgpp2/coff ------------ - * all overlays (except Allegro pakfiles) are silently stripped + * compressing files which contain a big BSS requires lots of memory + during compression diff --git a/README b/README index c7e78075..2668fa9e 100644 --- a/README +++ b/README @@ -13,11 +13,27 @@ http://upx.tsx.org + +WARNING - UNSTABLE BETA VERSION +=============================== + +All versions 1.1x are unstable beta releases - use them only for testing, +and never distribute a program that is packed with them ! +There will be hidden bugs. Really. + +The current stable release is 1.04, and the next stable release +will be called version 1.20. + +The main news since 1.04 are support for bootable Linux kernels ("vmlinuz/386") +and direct Linux ELF-to-memory decompression ("linux/elf386"), so there's +no reason to use the unstable versions unless you want to try the new formats. + + WELCOME ======= -Welcome to UPX 1.00, the first production release (after almost two years -of beta testing). +Welcome to UPX 1.0x, the first production release after almost two years +of beta testing. Please don't forget to read the new LICENSE - UPX is now distributed under the GNU General Public License (GPL) with special exceptions @@ -38,7 +54,8 @@ and run exactly as before, with no runtime or memory penalty for most of the supported formats. UPX supports a number of different executable formats, including -Win95/98/2000/NT programs and DLLs, DOS programs, and Linux executables. +Win95/98/ME/NT/2000 programs and DLLs, DOS programs, and Linux +executables and kernels. UPX is free software distributed under the term of the GNU General Public License. Full source code is available. diff --git a/README.1ST b/README.1ST new file mode 100644 index 00000000..189e51c1 --- /dev/null +++ b/README.1ST @@ -0,0 +1,28 @@ + ooooo ooo ooooooooo. ooooooo ooooo + `888' `8' `888 `Y88. `8888 d8' + 888 8 888 .d88' Y888..8P + 888 8 888ooo88P' `8888' + 888 8 888 .8PY888. + `88. .8' 888 d8' `888b + `YbodP' o888o o888o o88888o + + + The Ultimate Packer for eXecutables + + + +WARNING - UNSTABLE BETA VERSION +=============================== + +All versions 1.1x are unstable beta releases - use them only for testing, +and never distribute a program that is packed with them ! +There will be hidden bugs. Really. + +The current stable release is 1.04, and the next stable release +will be called version 1.20. + +The main news since 1.04 are support for bootable Linux kernels ("vmlinuz/386") +and direct Linux ELF-to-memory decompression ("linux/elf386"), so there's +no reason to use the unstable versions unless you want to try the new formats. + + diff --git a/doc/upx.pod b/doc/upx.pod index 9be7ac0e..18028fdf 100644 --- a/doc/upx.pod +++ b/doc/upx.pod @@ -350,7 +350,7 @@ Introduction ("linux/386"). We will start with a general discussion first, but please - also read the relevant docs for each of the formats. + also read the relevant docs for each of the individual formats. Also, there is special support for bootable kernels - see the description of the vmlinuz/386 format. @@ -537,7 +537,7 @@ How it works: the file into low memory, then maps the shell (and its PT_INTERP), and passes control to the shell with the entire decompressed file as the argument after "-c". Known shells are sh, ash, bash, bsh, csh, - ksh, tcsh, pdksh. Restriction: UPX 1.10 cannot use this method + ksh, tcsh, pdksh. Restriction: UPX cannot use this method for shell scripts which use the one optional string argument after the shell name in the script (example: "#! /bin/sh option3\n".) diff --git a/src/Makefile b/src/Makefile index 47c95b59..bf850507 100644 --- a/src/Makefile +++ b/src/Makefile @@ -48,6 +48,10 @@ override target = vc6 endif +# util var for use in the rules - basename of the current target +override T = $(basename $@) + + # /*********************************************************************** # // object files # ************************************************************************/ @@ -120,7 +124,7 @@ LDFLAGS = -g else LDFLAGS = -s endif -LDFLAGS += -Wl,-Map,$(basename $@).map +LDFLAGS += -Wl,-Map,$T.map LDLIBS = LDLIBS = -lz LIBDIRS = @@ -230,7 +234,7 @@ CFLAGS = -W4 -WX CXXFLAGS1 = $(CFLAGS) -GR -GX -EHa CXXFLAGS2 = $(CFLAGS) LDFLAGS = -LINK_LDFLAGS = /link /map:$(basename $@).map +LINK_LDFLAGS = /link /map:$T.map ifneq ($(strip $(DOS_LIBDIRS)),) LIB := $(DOS_LIBDIRS);$(LIB) @@ -245,8 +249,7 @@ ifeq (1,2) else # link against msvcrt.dll CC += -MD - ##LDLIBS = $(u).lib zlib.lib setargv.obj - LDLIBS = $(u).lib setargv.obj + LDLIBS = $(DOS_LDLIBS) zlib.lib setargv.obj endif ifeq ($(DEBUG),1) CFLAGS += -Od -ZI @@ -306,8 +309,7 @@ CXXFLAGS1 = $(CFLAGS) CXXFLAGS2 = $(CFLAGS) CFLAGS_OUTPUT = -o$@ LDFLAGS = -##LDLIBS = $(u).lib zlib.lib -LDLIBS = $(u).lib +LDLIBS = $(DOS_LDLIBS) zlib.lib ifneq ($(strip $(DOS_LIBDIRS)),) LIB := $(DOS_LIBDIRS);$(LIB) @@ -363,6 +365,17 @@ $(upx_exe): $(OBJECTS) $(LIBS) $(LINK_EXE) $(STUBEDIT_EXE) + +ifeq ($(target),djgpp2) +cwsbind: $(upx_exe) + -rm -f $T.cof + $(upx_exe) -1 --coff -o $T.cof $(upx_exe) + cat $(DJDIR)/bin/cwsdstub.exe $T.cof > $(upx_exe) + $(upx_exe) -d $(upx_exe) + $(upx_exe) --best $(upx_exe) +endif + + unupx: $(MAKE) target=vc6 unupx.dll diff --git a/src/Makefile.inc b/src/Makefile.inc index d3588595..a8a76086 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -26,10 +26,12 @@ DOS_LIBDIRS := $(DOS_LIBDIRS);$(UDIR) endif LDLIBS += -l$(u) +DOS_LDLIBS += $(u).lib DEFS := $(DEFS) INCLUDES := $(INCLUDES) LIBDIRS := $(LIBDIRS) LDLIBS := $(LDLIBS) +DOS_LDLIBS := $(DOS_LDLIBS) diff --git a/src/conf.h b/src/conf.h index 30c3ac2c..35cbd279 100644 --- a/src/conf.h +++ b/src/conf.h @@ -227,11 +227,6 @@ typedef RETSIGTYPE (SIGTYPEENTRY *sig_type)(int); # define MODE_T int #endif -#if !defined(HAVE_STRCHR) -# if defined(HAVE_INDEX) -# define strchr index -# endif -#endif #if !defined(HAVE_STRCASECMP) # if defined(HAVE_STRICMP) # define strcasecmp stricmp @@ -299,8 +294,10 @@ typedef RETSIGTYPE (SIGTYPEENTRY *sig_type)(int); #endif -// avoid warnings about shadowing that obsolete index() function -#define index upx_index +// avoid warnings about shadowing global functions +#define basename upx_basename +#define index upx_index +#define outp upx_outp // a dummy statement #define nop ((void)0) diff --git a/src/help.cpp b/src/help.cpp index 10c19a81..cf75e1b9 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -127,9 +127,21 @@ void show_help(int x) con_fprintf(f,"Overlay options:\n"); fg = con_fg(f,fg); con_fprintf(f, - " --overlay=skip don't compress a file with an overlay\n" " --overlay=copy copy any extra data attached to the file [default]\n" " --overlay=strip strip any extra data attached to the file [dangerous]\n" + " --overlay=skip don't compress a file with an overlay\n" + "\n"); + fg = con_fg(f,FG_YELLOW); + con_fprintf(f,"Options for djgpp2/coff:\n"); + fg = con_fg(f,fg); + con_fprintf(f, + " --coff produce COFF output [default: EXE]\n" + "\n"); + fg = con_fg(f,FG_YELLOW); + con_fprintf(f,"Options for dos/com:\n"); + fg = con_fg(f,fg); + con_fprintf(f, + " --8086 make compressed com work on any 8086\n" "\n"); fg = con_fg(f,FG_YELLOW); con_fprintf(f,"Options for dos/exe:\n"); @@ -139,24 +151,12 @@ void show_help(int x) " --no-reloc put no relocations in to the exe header\n" "\n"); fg = con_fg(f,FG_YELLOW); - con_fprintf(f,"Options for dos/com:\n"); - fg = con_fg(f,fg); - con_fprintf(f, - " --8086 make compressed com work on any 8086\n" - "\n"); - fg = con_fg(f,FG_YELLOW); con_fprintf(f,"Options for dos/sys:\n"); fg = con_fg(f,fg); con_fprintf(f, " --8086 make compressed sys work on any 8086\n" "\n"); fg = con_fg(f,FG_YELLOW); - con_fprintf(f,"Options for djgpp2/coff:\n"); - fg = con_fg(f,fg); - con_fprintf(f, - " --coff produce COFF output [default: EXE]\n" - "\n"); - fg = con_fg(f,FG_YELLOW); con_fprintf(f,"Options for watcom/le:\n"); fg = con_fg(f,fg); con_fprintf(f, @@ -177,7 +177,7 @@ void show_help(int x) "\n"); #if 0 fg = con_fg(f,FG_YELLOW); - con_fprintf(f,"Options for linux/i386\n"); + con_fprintf(f,"Options for linux/386\n"); fg = con_fg(f,fg); con_fprintf(f, " --script use /usr/local/lib/upx/upx[bd] as decompressor\n" @@ -189,12 +189,23 @@ void show_help(int x) con_fprintf(f, " file.. executables to (de)compress\n" "\n" - "This version supports: dos/exe, dos/com, dos/sys, djgpp2/coff, watcom/le,\n" - " win32/pe, rtm32/pe, tmt/adam, atari/tos\n" - " linux/elf386, linux/sh386, linux/386\n" - "%s", - "\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit http://upx.tsx.org\n" - //"\nUPX comes with ABSOLUTELY NO WARRANTY; for details type `upx -L'.\n" + "This version supports:\n " + "atari/tos, " + "bvmlinuz/386, " + "djgpp2/coff, " + "dos/com, " + "dos/exe, " + "dos/sys,\n " + "linux/386, " + "linux/elf386, " + "linux/sh386, " + "rtm32/pe, " + "tmt/adam, " + "vmlinuz/386,\n " + "watcom/le, " + "win32/pe" + "\n\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit http://upx.tsx.org\n" + //"\n\nUPX comes with ABSOLUTELY NO WARRANTY; for details type `upx -L'.\n" ""); diff --git a/src/main.cpp b/src/main.cpp index 1c5858e6..89712754 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1136,6 +1136,14 @@ int main(int argc, char *argv[]) fg = con_fg(f,fg); } #endif +#if 1 && !defined(WITH_NRV) + { + FILE *f = stdout; + int fg = con_fg(f,FG_GREEN); + con_fprintf(f,"\nINFO: this version does not use the NRV library - compression ratio is worse\n"); + fg = con_fg(f,fg); + } +#endif #if 0 && defined(__GLIBC__) //malloc_stats(); diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 98aeeba3..84658476 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -130,7 +130,7 @@ void PackLinuxI386elf::patchLoader() upx_compress_config_t conf; memset(&conf, 0xff, sizeof(conf)); conf.c_flags = 0; upx_uint result_buffer[16]; - size_t cprLsize; + upx_uint cprLsize; upx_compress( loader + fold_begin, lsize - fold_begin, cprLoader, &cprLsize, diff --git a/src/p_lx_sh.cpp b/src/p_lx_sh.cpp index d35ca115..de7d9593 100644 --- a/src/p_lx_sh.cpp +++ b/src/p_lx_sh.cpp @@ -110,7 +110,7 @@ void PackLinuxI386sh::patchLoader() upx_compress_config_t conf; memset(&conf, 0xff, sizeof(conf)); conf.c_flags = 0; upx_uint result_buffer[16]; - size_t cprLsize; + upx_uint cprLsize; upx_compress( loader + fold_begin, lsize - fold_begin, cprLoader, &cprLsize, diff --git a/src/p_unix.cpp b/src/p_unix.cpp index bab0434f..a459cf29 100644 --- a/src/p_unix.cpp +++ b/src/p_unix.cpp @@ -447,8 +447,8 @@ void PackLinuxI386::patchLoader() upx_compress_config_t conf; memset(&conf, 0xff, sizeof(conf)); conf.c_flags = 0; upx_uint result_buffer[16]; - size_t const uncLsize = lsize - fold_begin; - size_t cprLsize; + upx_uint const uncLsize = lsize - fold_begin; + upx_uint cprLsize; upx_compress( loader + fold_begin, uncLsize, cprLoader, &cprLsize,