upx.doc 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. NAME
  2. upx - compress or expand executable files
  3. SYNOPSIS
  4. upx [ *command* ] [ *options* ] *filename*...
  5. ABSTRACT
  6. The Ultimate Packer for eXecutables
  7. Copyright (c) 1996-2006 Markus Oberhumer, Laszlo Molnar & John Reiser
  8. http://upx.sourceforge.net
  9. UPX is a portable, extendable, high-performance executable packer for
  10. several different executable formats. It achieves an excellent
  11. compression ratio and offers **very** fast decompression. Your
  12. executables suffer no memory overhead or other drawbacks for most of the
  13. formats supported, because of in-place decompression.
  14. While you may use UPX freely for both non-commercial and commercial
  15. executables (for details see the file LICENSE), we would highly
  16. appreciate if you credit UPX and ourselves in the documentation,
  17. possibly including a reference to the UPX home page. Thanks.
  18. [ Using UPX in non-OpenSource applications without proper credits is
  19. considered not politically correct ;-) ]
  20. DISCLAIMER
  21. UPX comes with ABSOLUTELY NO WARRANTY; for details see the file LICENSE.
  22. This is the first production quality release, and we plan that future
  23. 1.xx releases will be backward compatible with this version.
  24. Please report all problems or suggestions to the authors. Thanks.
  25. DESCRIPTION
  26. UPX is a versatile executable packer with the following features:
  27. - excellent compression ratio: compresses better than zip/gzip,
  28. use UPX to decrease the size of your distribution !
  29. - very fast decompression: about 10 MB/sec on an ancient Pentium 133,
  30. about 200 MB/sec on an Athlon XP 2000+.
  31. - no memory overhead for your compressed executables for most of the
  32. supported formats
  33. - safe: you can list, test and unpack your executables
  34. Also, a checksum of both the compressed and uncompressed file is
  35. maintained internally.
  36. - universal: UPX can pack a number of executable formats:
  37. * atari/tos
  38. * bvmlinuz/386 [bootable Linux kernel]
  39. * djgpp2/coff
  40. * dos/com
  41. * dos/exe
  42. * dos/sys
  43. * linux/386
  44. * linux/elf386
  45. * linux/sh386
  46. * ps1/exe
  47. * rtm32/pe
  48. * tmt/adam
  49. * vmlinuz/386 [bootable Linux kernel]
  50. * vmlinux/386
  51. * watcom/le (supporting DOS4G, PMODE/W, DOS32a and CauseWay)
  52. * win32/pe (exe and dll)
  53. * arm/pe (exe and dll)
  54. * linux/elfamd64
  55. * linux/elfppc32
  56. * mach/elfppc32
  57. - portable: UPX is written in portable endian-neutral C++
  58. - extendable: because of the class layout it's very easy to support
  59. new executable formats or add new compression algorithms
  60. - free: UPX can be distributed and used freely. And from version 0.99
  61. the full source code of UPX is released under the GNU General Public
  62. License (GPL) !
  63. You probably understand now why we call UPX the "*ultimate*" executable
  64. packer.
  65. COMMANDS
  66. Compress
  67. This is the default operation, eg. upx yourfile.exe will compress the
  68. file specified on the command line.
  69. Decompress
  70. All UPX supported file formats can be unpacked using the -d switch, eg.
  71. upx -d yourfile.exe will uncompress the file you've just compressed.
  72. Test
  73. The -t command tests the integrity of the compressed and uncompressed
  74. data, eg. upx -t yourfile.exe check whether your file can be safely
  75. decompressed. Note, that this command doesn't check the whole file, only
  76. the part that will be uncompressed during program execution. This means
  77. that you should not use this command instead of a virus checker.
  78. List
  79. The -l command prints out some information about the compressed files
  80. specified on the command line as parameters, eg upx -l yourfile.exe
  81. shows the compressed / uncompressed size and the compression ratio of
  82. *yourfile.exe*.
  83. OPTIONS
  84. -q: be quiet, suppress warnings
  85. -q -q (or -qq): be very quiet, suppress errors
  86. -q -q -q (or -qqq): produce no output at all
  87. --help: prints the help
  88. --version: print the version of UPX
  89. [ ...to be written... - type `upx --help' for now ]
  90. COMPRESSION LEVELS & TUNING
  91. UPX offers ten different compression levels from -1 to -9, and --best.
  92. The default compression level is -8 for files smaller than 512 kB, and
  93. -7 otherwise.
  94. * Compression levels 1, 2 and 3 are pretty fast.
  95. * Compression levels 4, 5 and 6 achieve a good time/ratio performance.
  96. * Compression levels 7, 8 and 9 favor compression ratio over speed.
  97. * Compression level --best may take a long time.
  98. Note that compression level --best can be somewhat slow for large files,
  99. but you definitely should use it when releasing a final version of your
  100. program.
  101. Quick start for achieving the best compression ratio:
  102. Try upx --brute myfile.exe.
  103. Details for achieving the best compression ratio:
  104. * Use the compression level --best.
  105. * Try one or both of the options --all-methods and --all-filters.
  106. * Try the option --crp-ms=NUMBER. This uses more memory during
  107. compression to achieve a (slightly) better compression ratio.
  108. NUMBER must be a decimal value from 10000 to 999999, inclusive. The
  109. default value is 10000 (ten thousand).
  110. * Info: the option --brute is an abbrevation for the options --best
  111. --all-methods --all-filters --crp-ms=999999.
  112. * Try if --overlay=strip works.
  113. * For win32/pe programs there's --strip-relocs=0. See notes below.
  114. OVERLAY HANDLING OPTIONS
  115. Info: An "overlay" means auxillary data atached after the logical end of
  116. an executable, and it often contains application specific data (this is
  117. a common practice to avoid an extra data file, though it would be better
  118. to use resource sections).
  119. UPX handles overlays like many other executable packers do: it simply
  120. copies the overlay after the compressed image. This works with some
  121. files, but doesn't work with others, depending on how an application
  122. actually accesses this overlayed data.
  123. --overlay=copy Copy any extra data attached to the file. [DEFAULT]
  124. --overlay=strip Strip any overlay from the program instead of
  125. copying it. Be warned, this may make the compressed
  126. program crash or otherwise unusable.
  127. --overlay=skip Refuse to compress any program which has an overlay.
  128. ENVIRONMENT
  129. The environment variable UPX can hold a set of default options for UPX.
  130. These options are interpreted first and can be overwritten by explicit
  131. command line parameters. For example:
  132. for DOS/Windows: set UPX=-9 --compress-icons#0
  133. for sh/ksh/zsh: UPX="-9 --compress-icons=0"; export UPX
  134. for csh/tcsh: setenv UPX "-9 --compress-icons=0"
  135. Under DOS/Windows you must use '#' instead of '=' when setting the
  136. environment variable because of a COMMAND.COM limitation.
  137. Not all of the options are valid in the environment variable - UPX will
  138. tell you.
  139. You can explicitly use the --no-env option to ignore the environment
  140. variable.
  141. NOTES FOR THE SUPPORTED EXECUTABLE FORMATS
  142. NOTES FOR ATARI/TOS
  143. This is the executable format used by the Atari ST/TT, a Motorola 68000
  144. based personal computer which was popular in the late '80s. Support of
  145. this format is only because of nostalgic feelings of one of the authors
  146. and serves no practical purpose :-). See http://www.freemint.de for more
  147. info.
  148. Packed programs will be byte-identical to the original after
  149. uncompression. All debug information will be stripped, though.
  150. Extra options available for this executable format:
  151. --all-methods Compress the program several times, using all
  152. available compression methods. This may improve
  153. the compression ratio in some cases, but usually
  154. the default method gives the best results anyway.
  155. NOTES FOR BVMLINUZ/I386
  156. Same as vmlinuz/i386.
  157. NOTES FOR DOS/COM
  158. Obviously UPX won't work with executables that want to read data from
  159. themselves (like some commandline utilities that ship with Win95/98/ME).
  160. Compressed programs only work on a 286+.
  161. Packed programs will be byte-identical to the original after
  162. uncompression.
  163. Maximum uncompressed size: ~65100 bytes.
  164. Extra options available for this executable format:
  165. --8086 Create an executable that works on any 8086 CPU.
  166. --all-methods Compress the program several times, using all
  167. available compression methods. This may improve
  168. the compression ratio in some cases, but usually
  169. the default method gives the best results anyway.
  170. --all-filters Compress the program several times, using all
  171. available preprocessing filters. This may improve
  172. the compression ratio in some cases, but usually
  173. the default filter gives the best results anyway.
  174. NOTES FOR DOS/EXE
  175. dos/exe stands for all "normal" 16-bit DOS executables.
  176. Obviously UPX won't work with executables that want to read data from
  177. themselves (like some command line utilities that ship with
  178. Win95/98/ME).
  179. Compressed programs only work on a 286+.
  180. Extra options available for this executable format:
  181. --8086 Create an executable that works on any 8086 CPU.
  182. --no-reloc Use no relocation records in the exe header.
  183. --all-methods Compress the program several times, using all
  184. available compression methods. This may improve
  185. the compression ratio in some cases, but usually
  186. the default method gives the best results anyway.
  187. NOTES FOR DOS/SYS
  188. Compressed programs only work on a 286+.
  189. Packed programs will be byte-identical to the original after
  190. uncompression.
  191. Maximum uncompressed size: ~65350 bytes.
  192. Extra options available for this executable format:
  193. --8086 Create an executable that works on any 8086 CPU.
  194. --all-methods Compress the program several times, using all
  195. available compression methods. This may improve
  196. the compression ratio in some cases, but usually
  197. the default method gives the best results anyway.
  198. --all-filters Compress the program several times, using all
  199. available preprocessing filters. This may improve
  200. the compression ratio in some cases, but usually
  201. the default filter gives the best results anyway.
  202. NOTES FOR DJGPP2/COFF
  203. First of all, it is recommended to use UPX *instead* of strip. strip has
  204. the very bad habit of replacing your stub with its own (outdated)
  205. version. Additionally UPX corrects a bug/feature in strip v2.8.x: it
  206. will fix the 4 KByte aligment of the stub.
  207. UPX includes the full functionality of stubify. This means it will
  208. automatically stubify your COFF files. Use the option --coff to disable
  209. this functionality (see below).
  210. UPX automatically handles Allegro packfiles.
  211. The DLM format (a rather exotic shared library extension) is not
  212. supported.
  213. Packed programs will be byte-identical to the original after
  214. uncompression. All debug information and trailing garbage will be
  215. stripped, though.
  216. Extra options available for this executable format:
  217. --coff Produce COFF output instead of EXE. By default
  218. UPX keeps your current stub.
  219. --all-methods Compress the program several times, using all
  220. available compression methods. This may improve
  221. the compression ratio in some cases, but usually
  222. the default method gives the best results anyway.
  223. --all-filters Compress the program several times, using all
  224. available preprocessing filters. This may improve
  225. the compression ratio in some cases, but usually
  226. the default filter gives the best results anyway.
  227. NOTES FOR LINUX [general]
  228. Introduction
  229. Linux/386 support in UPX consists of 3 different executable formats,
  230. one optimized for ELF excutables ("linux/elf386"), one optimized
  231. for shell scripts ("linux/sh386"), and one generic format
  232. ("linux/386").
  233. We will start with a general discussion first, but please
  234. also read the relevant docs for each of the individual formats.
  235. Also, there is special support for bootable kernels - see the
  236. description of the vmlinuz/386 format.
  237. General user's overview
  238. Running a compressed executable program trades less space on a
  239. ``permanent'' storage medium (such as a hard disk, floppy disk,
  240. CD-ROM, flash memory, EPROM, etc.) for more space in one or more
  241. ``temporary'' storage media (such as RAM, swap space, /tmp, etc.).
  242. Running a compressed executable also requires some additional CPU
  243. cycles to generate the compressed executable in the first place,
  244. and to decompress it at each invocation.
  245. How much space is traded? It depends on the executable, but many
  246. programs save 30% to 50% of permanent disk space. How much CPU
  247. overhead is there? Again, it depends on the executable, but
  248. decompression speed generally is at least many megabytes per second,
  249. and frequently is limited by the speed of the underlying disk
  250. or network I/O.
  251. Depending on the statistics of usage and access, and the relative
  252. speeds of CPU, RAM, swap space, /tmp, and filesystem storage, then
  253. invoking and running a compressed executable can be faster than
  254. directly running the corresponding uncompressed program.
  255. The operating system might perfrom fewer expensive I/O operations
  256. to invoke the compressed program. Paging to or from swap space
  257. or /tmp might be faster than paging from the general filesystem.
  258. ``Medium-sized'' programs which access about 1/3 to 1/2 of their
  259. stored program bytes can do particulary well with compression.
  260. Small programs tend not to benefit as much because the absolute
  261. savings is less. Big programs tend not to benefit proportionally
  262. because each invocation may use only a small fraction of the program,
  263. yet UPX decompresses the entire program before invoking it.
  264. But in environments where disk or flash memory storage is limited,
  265. then compression may win anyway.
  266. Currently, executables compressed by UPX do not share RAM at runtime
  267. in the way that executables mapped from a filesystem do. As a
  268. result, if the same program is run simultaneously by more than one
  269. process, then using the compressed version will require more RAM and/or
  270. swap space. So, shell programs (bash, csh, etc.) and ``make''
  271. might not be good candidates for compression.
  272. UPX recognizes three executable formats for Linux: Linux/elf386,
  273. Linux/sh386, and Linux/386. Linux/386 is the most generic format;
  274. it accommodates any file that can be executed. At runtime, the UPX
  275. decompression stub re-creates in /tmp a copy of the original file,
  276. and then the copy is (re-)executed with the same arguments.
  277. ELF binary executables prefer the Linux/elf386 format by default,
  278. because UPX decompresses them directly into RAM, uses only one
  279. exec, does not use space in /tmp, and does not use /proc.
  280. Shell scripts where the underlying shell accepts a ``-c'' argument
  281. can use the Linux/sh386 format. UPX decompresses the shell script
  282. into low memory, then maps the shell and passes the entire text of the
  283. script as an argument with a leading ``-c''.
  284. General benefits:
  285. - UPX can compress all executables, be it AOUT, ELF, libc4, libc5,
  286. libc6, Shell/Perl/Python/... scripts, standalone Java .class
  287. binaries, or whatever...
  288. All scripts and programs will work just as before.
  289. - Compressed programs are completely self-contained. No need for
  290. any external program.
  291. - UPX keeps your original program untouched. This means that
  292. after decompression you will have a byte-identical version,
  293. and you can use UPX as a file compressor just like gzip.
  294. [ Note that UPX maintains a checksum of the file internally,
  295. so it is indeed a reliable alternative. ]
  296. - As the stub only uses syscalls and isn't linked against libc it
  297. should run under any Linux configuration that can run ELF
  298. binaries.
  299. - For the same reason compressed executables should run under
  300. FreeBSD and other systems which can run Linux binaries.
  301. [ Please send feedback on this topic ]
  302. General drawbacks:
  303. - It is not advisable to compress programs which usually have many
  304. instances running (like `sh' or `make') because the common segments of
  305. compressed programs won't be shared any longer between different
  306. processes.
  307. - `ldd' and `size' won't show anything useful because all they
  308. see is the statically linked stub. Since version 0.82 the section
  309. headers are stripped from the UPX stub and `size' doesn't even
  310. recognize the file format. The file patches/patch-elfcode.h has a
  311. patch to fix this bug in `size' and other programs which use GNU BFD.
  312. General notes:
  313. - As UPX leaves your original program untouched it is advantageous
  314. to strip it before compression.
  315. - If you compress a script you will lose platform independence -
  316. this could be a problem if you are using NFS mounted disks.
  317. - Compression of suid, guid and sticky-bit programs is rejected
  318. because of possible security implications.
  319. - For the same reason there is no sense in making any compressed
  320. program suid.
  321. - Obviously UPX won't work with executables that want to read data
  322. from themselves. E.g., this might be a problem for Perl scripts
  323. which access their __DATA__ lines.
  324. - In case of internal errors the stub will abort with exitcode 127.
  325. Typical reasons for this to happen are that the program has somehow
  326. been modified after compression.
  327. Running `strace -o strace.log compressed_file' will tell you more.
  328. NOTES FOR LINUX/ELF386
  329. Please read the general Linux description first.
  330. The linux/elf386 format decompresses directly into RAM, uses only one
  331. exec, does not use space in /tmp, and does not use /proc.
  332. Linux/elf386 is automatically selected for Linux ELF exectuables.
  333. Packed programs will be byte-identical to the original after
  334. uncompression.
  335. How it works:
  336. For ELF executables, UPX decompresses directly to memory, simulating
  337. the mapping that the operating system kernel uses during exec(),
  338. including the PT_INTERP program interpreter (if any).
  339. The brk() is set by a special PT_LOAD segment in the compressed
  340. executable itself. UPX then wipes the stack clean except for
  341. arguments, environment variables, and Elf_auxv entries (this is
  342. required by bugs in the startup code of /lib/ld-linux.so as of
  343. May 2000), and transfers control to the program interpreter or
  344. the e_entry address of the original executable.
  345. The UPX stub is about 1700 bytes long, partly written in assembler
  346. and only uses kernel syscalls. It is not linked against any libc.
  347. Specific drawbacks:
  348. - For linux/elf386 and linux/sh386 formats, you will be relying on
  349. RAM and swap space to hold all of the decompressed program during
  350. the lifetime of the process. If you already use most of your swap
  351. space, then you may run out. A system that is "out of memory"
  352. can become fragile. Many programs do not react gracefully when
  353. malloc() returns 0. With newer Linux kernels, the kernel
  354. may decide to kill some processes to regain memory, and you
  355. may not like the kernel's choice of which to kill. Running
  356. /usr/bin/top is one way to check on the usage of swap space.
  357. Extra options available for this executable format:
  358. (none)
  359. NOTES FOR LINUX/SH386
  360. Please read the general Linux description first.
  361. Shell scripts where the underling shell accepts a ``-c'' argument can
  362. use the Linux/sh386 format. UPX decompresses the shell script into low
  363. memory, then maps the shell and passes the entire text of the script as
  364. an argument with a leading ``-c''. It does not use space in /tmp, and
  365. does not use /proc.
  366. Linux/sh386 is automatically selected for shell scripts that use a known
  367. shell.
  368. Packed programs will be byte-identical to the original after
  369. uncompression.
  370. How it works:
  371. For shell script executables (files beginning with "#!/" or "#! /")
  372. where the shell is known to accept "-c <command>", UPX decompresses
  373. the file into low memory, then maps the shell (and its PT_INTERP),
  374. and passes control to the shell with the entire decompressed file
  375. as the argument after "-c". Known shells are sh, ash, bash, bsh, csh,
  376. ksh, tcsh, pdksh. Restriction: UPX cannot use this method
  377. for shell scripts which use the one optional string argument after
  378. the shell name in the script (example: "#! /bin/sh option3\n".)
  379. The UPX stub is about 1700 bytes long, partly written in assembler
  380. and only uses kernel syscalls. It is not linked against any libc.
  381. Specific drawbacks:
  382. - For linux/elf386 and linux/sh386 formats, you will be relying on
  383. RAM and swap space to hold all of the decompressed program during
  384. the lifetime of the process. If you already use most of your swap
  385. space, then you may run out. A system that is "out of memory"
  386. can become fragile. Many programs do not react gracefully when
  387. malloc() returns 0. With newer Linux kernels, the kernel
  388. may decide to kill some processes to regain memory, and you
  389. may not like the kernel's choice of which to kill. Running
  390. /usr/bin/top is one way to check on the usage of swap space.
  391. Extra options available for this executable format:
  392. (none)
  393. NOTES FOR LINUX/386
  394. Please read the general Linux description first.
  395. The generic linux/386 format decompresses to /tmp and needs /proc
  396. filesystem support. It starts the decompressed program via the execve()
  397. syscall.
  398. Linux/386 is only selected if the specialized linux/elf386 and
  399. linux/sh386 won't recognize a file.
  400. Packed programs will be byte-identical to the original after
  401. uncompression.
  402. How it works:
  403. For files which are not ELF and not a script for a known "-c" shell,
  404. UPX uses kernel execve(), which first requires decompressing to a
  405. temporary file in the filesystem. Interestingly -
  406. because of the good memory management of the Linux kernel - this
  407. often does not introduce a noticable delay, and in fact there
  408. will be no disk access at all if you have enough free memory as
  409. the entire process takes places within the filesystem buffers.
  410. A compressed executable consists of the UPX stub and an overlay
  411. which contains the original program in a compressed form.
  412. The UPX stub is a statically linked ELF executable and does
  413. the following at program startup:
  414. 1) decompress the overlay to a temporary location in /tmp
  415. 2) open the temporary file for reading
  416. 3) try to delete the temporary file and start (execve)
  417. the uncompressed program in /tmp using /proc/<pid>/fd/X as
  418. attained by step 2)
  419. 4) if that fails, fork off a subprocess to clean up and
  420. start the program in /tmp in the meantime
  421. The UPX stub is about 1700 bytes long, partly written in assembler
  422. and only uses kernel syscalls. It is not linked against any libc.
  423. Specific drawbacks:
  424. - You need additional free disk space for the uncompressed program
  425. in your /tmp directory. This program is deleted immediately after
  426. decompression, but you still need it for the full execution time
  427. of the program.
  428. - You must have /proc filesystem support as the stub wants to open
  429. /proc/<pid>/exe and needs /proc/<pid>/fd/X. This also means that you
  430. cannot compress programs that are used during the boot sequence
  431. before /proc is mounted.
  432. - Utilities like `top' will display numerical values in the process
  433. name field. This is because Linux computes the process name from
  434. the first argument of the last execve syscall (which is typically
  435. something like /proc/<pid>/fd/3).
  436. - Because of temporary decompression to disk the decompression speed
  437. is not as fast as with the other executable formats. Still, I can see
  438. no noticable delay when starting programs like my ~3 MB emacs (which
  439. is less than 1 MB when compressed :-).
  440. Extra options available for this executable format:
  441. --force-execve Force the use of the generic linux/386 "execve"
  442. format, i.e. do not try the linux/elf386 and
  443. linux/sh386 formats.
  444. NOTES FOR PS1/EXE
  445. This is the executable format used by the Sony PlayStation (PSone), a
  446. Mips R3000 based gaming console which is popular since the late '90s.
  447. Support of this format is very similar to the Atari one, because of
  448. nostalgic feelings of one of the authors.
  449. Packed programs will be byte-identical to the original after
  450. uncompression, until further notice.
  451. Maximum uncompressed size: ~1998848 bytes.
  452. Notes:
  453. - UPX creates as default a 'CD-Rom only' PS1/PS2 compatible executable.
  454. For transfer between client/target use options below.
  455. - Normally the packed files use the same memory areas like the uncompressed
  456. versions, so they will not override other memory areas while unpacking.
  457. If this isn't possible UPX will abort showing a 'packed data overlap'
  458. error. With the "--force" option UPX will set a few 'bytes higher' loading
  459. offset for the packed file, but this isn't a real problem if it is a
  460. single or boot-only executable.
  461. Extra options available for this executable format:
  462. --all-methods Compress the program several times, using all
  463. available compression methods. This may improve
  464. the compression ratio in some cases, but usually
  465. the default method gives the best results anyway.
  466. --boot-only The format will only run from a CD and may slightly
  467. improves the compression ratio. The decompression
  468. routines are faster than default ones.
  469. But it cannot be used for host/client transfer !
  470. --no-align This option disables CD mode 2 data sector format
  471. alignment. May slightly improves the compression ratio,
  472. but the compressed executable will not boot from a CD.
  473. Use it for client/target transfer only !
  474. NOTES FOR RTM32/PE and ARM/PE
  475. Same as win32/pe.
  476. NOTES FOR TMT/ADAM
  477. This format is used by the TMT Pascal compiler - see http://www.tmt.com/
  478. .
  479. Extra options available for this executable format:
  480. --all-methods Compress the program several times, using all
  481. available compression methods. This may improve
  482. the compression ratio in some cases, but usually
  483. the default method gives the best results anyway.
  484. --all-filters Compress the program several times, using all
  485. available preprocessing filters. This may improve
  486. the compression ratio in some cases, but usually
  487. the default filter gives the best results anyway.
  488. NOTES FOR VMLINUZ/386
  489. The vmlinuz/386 and bvmlinuz/386 formats take a gzip-compressed bootable
  490. Linux kernel image ("vmlinuz", "zImage", "bzImage"), gzip-decompress it
  491. and re-compress it with the UPX compression method.
  492. vmlinuz/386 is completely unrelated to the other Linux executable
  493. formats, and it does not share any of their drawbacks.
  494. Notes:
  495. - Be sure that "vmlinuz/386" or "bvmlinuz/386" is displayed
  496. during compression - otherwise a wrong executable format
  497. may have been used, and the kernel won't boot.
  498. Benefits:
  499. - Better compression (but note that the kernel was already compressed,
  500. so the improvement is not as large as with other formats).
  501. Still, the bytes saved may be essential for special needs like
  502. bootdisks.
  503. For example, this is what I get for my 2.2.16 kernel:
  504. 1589708 vmlinux
  505. 641073 bzImage [original]
  506. 560755 bzImage.upx [compressed by "upx -9"]
  507. - Much faster decompression at kernel boot time (but kernel
  508. decompression speed is not really an issue these days).
  509. Drawbacks:
  510. (none)
  511. Extra options available for this executable format:
  512. --all-methods Compress the program several times, using all
  513. available compression methods. This may improve
  514. the compression ratio in some cases, but usually
  515. the default method gives the best results anyway.
  516. --all-filters Compress the program several times, using all
  517. available preprocessing filters. This may improve
  518. the compression ratio in some cases, but usually
  519. the default filter gives the best results anyway.
  520. NOTES FOR WATCOM/LE
  521. UPX has been successfully tested with the following extenders: DOS4G,
  522. DOS4GW, PMODE/W, DOS32a, CauseWay. The WDOS/X extender is partly
  523. supported (for details see the file bugs BUGS).
  524. DLLs and the LX format are not supported.
  525. Extra options available for this executable format:
  526. --le Produce an unbound LE output instead of
  527. keeping the current stub.
  528. NOTES FOR WIN32/PE
  529. The PE support in UPX is quite stable now, but probably there are still
  530. some incompabilities with some files.
  531. Because of the way UPX (and other packers for this format) works, you
  532. can see increased memory usage of your compressed files because the
  533. whole program is loaded into memory at startup. If you start several
  534. instances of huge compressed programs you're wasting memory because the
  535. common segements of the program won't get shared across the instances.
  536. On the other hand if you're compressing only smaller programs, or
  537. running only one instance of larger programs, then this penalty is
  538. smaller, but it's still there.
  539. If you're running executables from network, then compressed programs
  540. will load faster, and require less bandwidth during execution.
  541. DLLs are supported. But UPX compressed DLLs can not share common data
  542. and code when they got used by multiple applications. So compressing
  543. msvcrt.dll is a waste of memory, but compressing the dll plugins of a
  544. particular application may be a better idea.
  545. Screensavers are supported, with the restriction that the filename must
  546. end with ".scr" (as screensavers are handled slightly different than
  547. normal exe files).
  548. UPX compressed PE files has some minor memory overhead (usually in the
  549. 10 - 30 kbytes range) which can be seen by specifying the "-i" command
  550. line switch during compression.
  551. Extra options available for this executable format:
  552. --compress-exports=0 Don't compress the export section.
  553. Use this if you plan to run the compressed
  554. program under Wine.
  555. --compress-exports=1 Compress the export section. [DEFAULT]
  556. Compression of the export section can improve the
  557. compression ratio quite a bit but may not work
  558. with all programs (like winword.exe).
  559. UPX never compresses the export section of a DLL
  560. regardless of this option.
  561. --compress-icons=0 Don't compress any icons.
  562. --compress-icons=1 Compress all but the first icon.
  563. --compress-icons=2 Compress all icons which are not in the
  564. first icon directory. [DEFAULT]
  565. --compress-resources=0 Don't compress any resources at all.
  566. --keep-resource=list Don't compress resources specified by the list.
  567. The members of the list are separated by commas.
  568. A list member has the following format: I<type[/name]>.
  569. I<Type> is the type of the resource. Standard types
  570. must be specified as decimal numbers, user types can be
  571. specified by decimal IDs or strings. I<Name> is the
  572. identifier of the resource. It can be a decimal number
  573. or a string. For example:
  574. --keep-resource=2/MYBITMAP,5,6/12345
  575. UPX won't compress the named bitmap resource "MYBITMAP",
  576. it leaves every dialog (5) resource uncompressed, and
  577. it won't touch the string table resource with identifier
  578. 12345.
  579. --force Force compression even when there is an
  580. unexpected value in a header field.
  581. Use with care.
  582. --strip-relocs=0 Don't strip relocation records.
  583. --strip-relocs=1 Strip relocation records. [DEFAULT]
  584. This option only works on executables with base
  585. address greater or equal to 0x400000. Usually the
  586. compressed files becomes smaller, but some files
  587. may become larger. Note that the resulting file will
  588. not work under Windows 3.x (Win32s).
  589. UPX never strips relocations from a DLL
  590. regardless of this option.
  591. --all-methods Compress the program several times, using all
  592. available compression methods. This may improve
  593. the compression ratio in some cases, but usually
  594. the default method gives the best results anyway.
  595. --all-filters Compress the program several times, using all
  596. available preprocessing filters. This may improve
  597. the compression ratio in some cases, but usually
  598. the default filter gives the best results anyway.
  599. DIAGNOSTICS
  600. Exit status is normally 0; if an error occurs, exit status is 1. If a
  601. warning occurs, exit status is 2.
  602. UPX's diagnostics are intended to be self-explanatory.
  603. BUGS
  604. Please report all bugs immediately to the authors.
  605. AUTHORS
  606. Markus F.X.J. Oberhumer <markus@oberhumer.com>
  607. http://www.oberhumer.com
  608. Laszlo Molnar <ml1050@users.sourceforge.net>
  609. John F. Reiser <jreiser@BitWagon.com>
  610. Jens Medoch <jssg@users.sourceforge.net>
  611. COPYRIGHT
  612. Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
  613. Copyright (C) 1996-2006 Laszlo Molnar
  614. Copyright (C) 2000-2006 John F. Reiser
  615. Copyright (C) 2002-2006 Jens Medoch
  616. This program may be used freely, and you are welcome to redistribute it
  617. under certain conditions.
  618. This program is distributed in the hope that it will be useful, but
  619. WITHOUT ANY WARRANTY; without even the implied warranty of
  620. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the UPX License
  621. Agreement for more details.
  622. You should have received a copy of the UPX License Agreement along with
  623. this program; see the file LICENSE. If not, visit the UPX home page.