Upx_Doxygen
https://github.com/upx/upx
conf.h
1 /* conf.h --
2 
3  This file is part of the UPX executable compressor.
4 
5  Copyright (C) 1996-2016 Markus Franz Xaver Johannes Oberhumer
6  Copyright (C) 1996-2016 Laszlo Molnar
7  All Rights Reserved.
8 
9  UPX and the UCL library are free software; you can redistribute them
10  and/or modify them under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of
12  the License, or (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; see the file COPYING.
21  If not, write to the Free Software Foundation, Inc.,
22  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 
24  Markus F.X.J. Oberhumer Laszlo Molnar
25  <markus@oberhumer.com> <ezerotven+github@gmail.com>
26  */
27 
28 
29 #ifndef __UPX_CONF_H
30 #define __UPX_CONF_H 1
31 
32 #include "version.h"
33 
34 #if !defined(_FILE_OFFSET_BITS)
35 # define _FILE_OFFSET_BITS 64
36 #endif
37 
38 
39 /*************************************************************************
40 // ACC
41 **************************************************************************/
42 
43 #ifndef ACC_CFG_USE_NEW_STYLE_CASTS
44 #define ACC_CFG_USE_NEW_STYLE_CASTS 1
45 #endif
46 #include "miniacc.h"
47 #if !(ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_MSC)
48  // other compilers may work, but we're NOT interested into supporting them
49 # error "only clang and gcc are officially supported"
50 #endif
51 // UPX sanity checks for a sane compiler
52 #if !defined(UINT_MAX) || (UINT_MAX != 0xffffffffL)
53 # error "UINT_MAX"
54 #endif
55 ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4)
56 ACC_COMPILE_TIME_ASSERT_HEADER((1u << 31) << 1 == 0)
57 ACC_COMPILE_TIME_ASSERT_HEADER(((int)(1u << 31)) >> 31 == -1) // arithmetic right shift
58 ACC_COMPILE_TIME_ASSERT_HEADER(CHAR_MAX == 255) // -funsigned-char
59 ACC_COMPILE_TIME_ASSERT_HEADER((char)(-1) > 0) // -funsigned-char
60 
61 #if (ACC_CC_MSC)
62 # pragma warning(error: 4319)
63 #endif
64 
65 // FIXME - quick hack for arm-wince-gcc-3.4 (Debian pocketpc-*.deb packages)
66 #if 1 && (ACC_ARCH_ARM) && defined(__pe__) && !defined(__CEGCC__) && !defined(_WIN32)
67 # undef HAVE_CHMOD
68 # undef HAVE_CHOWN
69 # undef HAVE_LSTAT
70 # undef HAVE_UTIME
71 #endif
72 
73 
74 #define ACC_WANT_ACC_INCD_H 1
75 #define ACC_WANT_ACC_INCE_H 1
76 #define ACC_WANT_ACC_LIB_H 1
77 #define ACC_WANT_ACC_CXX_H 1
78 #include "miniacc.h"
79 
80 /* intergral types */
81 typedef acc_int8_t upx_int8_t;
82 typedef acc_uint8_t upx_uint8_t;
83 typedef acc_int16_t upx_int16_t;
84 typedef acc_uint16_t upx_uint16_t;
85 typedef acc_int32_t upx_int32_t;
86 typedef acc_uint32_t upx_uint32_t;
87 typedef acc_int64_t upx_int64_t;
88 typedef acc_uint64_t upx_uint64_t;
89 typedef acc_uintptr_t upx_uintptr_t;
90 #define UPX_INT16_C ACC_INT16_C
91 #define UPX_UINT16_C ACC_UINT16_C
92 #define UPX_INT32_C ACC_INT32_C
93 #define UPX_UINT32_C ACC_UINT32_C
94 #define UPX_INT64_C ACC_INT64_C
95 #define UPX_UINT64_C ACC_UINT64_C
96 
97 typedef unsigned char upx_byte;
98 #define upx_bytep upx_byte *
99 
100 
101 /*************************************************************************
102 //
103 **************************************************************************/
104 
105 #if defined(__linux__) && !defined(__unix__)
106 # define __unix__ 1
107 #endif
108 
109 // just in case
110 #undef _
111 #undef __
112 #undef ___
113 #undef NDEBUG
114 #undef dos
115 #undef linux
116 #undef small
117 #undef tos
118 #if defined(__DJGPP__)
119 # undef sopen
120 # undef __unix__
121 # undef __unix
122 #endif
123 
124 #define WITH_UCL 1
125 #define WITH_ZLIB 1
126 #if !defined(WITH_LZMA) || (WITH_LZMA+0 == 0)
127 # error "WITH_LZMA is missing"
128 #elif (WITH_LZMA != 0x443)
129 # error "invalid WITH_LZMA version"
130 #endif
131 #if defined(UPX_OFFICIAL_BUILD)
132 # if !(WITH_LZMA && WITH_NRV && WITH_UCL && WITH_ZLIB)
133 # error
134 # endif
135 #endif
136 #if (WITH_UCL)
137 # define ucl_compress_config_t REAL_ucl_compress_config_t
138 # include <ucl/uclconf.h>
139 # include <ucl/ucl.h>
140 # if !defined(UCL_VERSION) || (UCL_VERSION < 0x010300L)
141 # error "please upgrade your UCL installation"
142 # endif
143 # undef ucl_compress_config_t
144 # undef ucl_compress_config_p
145 #endif
146 
147 
148 /*************************************************************************
149 // system includes
150 **************************************************************************/
151 
152 // malloc debuggers
153 #if (WITH_VALGRIND)
154 # include <valgrind/memcheck.h>
155 #endif
156 #if !defined(VALGRIND_MAKE_MEM_DEFINED)
157 # define VALGRIND_MAKE_MEM_DEFINED(addr,len) 0
158 #endif
159 #if !defined(VALGRIND_MAKE_MEM_NOACCESS)
160 # define VALGRIND_MAKE_MEM_NOACCESS(addr,len) 0
161 #endif
162 #if !defined(VALGRIND_MAKE_MEM_UNDEFINED)
163 # define VALGRIND_MAKE_MEM_UNDEFINED(addr,len) 0
164 #endif
165 
166 
167 // IMPORTANT: unconditionally enable assertions
168 #undef NDEBUG
169 #include <assert.h>
170 
171 // protect against integer overflows and malicious header fields
172 // see C 11 standard, Annex K
173 typedef size_t upx_rsize_t;
174 #define UPX_RSIZE_MAX UPX_RSIZE_MAX_MEM
175 #define UPX_RSIZE_MAX_MEM (768 * 1024 * 1024) // DO NOT CHANGE
176 #define UPX_RSIZE_MAX_STR (1024 * 1024)
177 
178 
179 /*************************************************************************
180 // portab
181 **************************************************************************/
182 
183 #ifndef STDIN_FILENO
184 # define STDIN_FILENO (fileno(stdin))
185 #endif
186 #ifndef STDOUT_FILENO
187 # define STDOUT_FILENO (fileno(stdout))
188 #endif
189 #ifndef STDERR_FILENO
190 # define STDERR_FILENO (fileno(stderr))
191 #endif
192 
193 
194 #if !(HAVE_STRCASECMP) && (HAVE_STRICMP)
195 # define strcasecmp stricmp
196 #endif
197 #if !(HAVE_STRNCASECMP) && (HAVE_STRNICMP)
198 # define strncasecmp strnicmp
199 #endif
200 
201 
202 #if !defined(S_IWUSR) && defined(_S_IWUSR)
203 # define S_IWUSR _S_IWUSR
204 #elif !defined(S_IWUSR) && defined(_S_IWRITE)
205 # define S_IWUSR _S_IWRITE
206 #endif
207 
208 #if !defined(S_IFMT) && defined(_S_IFMT)
209 # define S_IFMT _S_IFMT
210 #endif
211 #if !defined(S_IFREG) && defined(_S_IFREG)
212 # define S_IFREG _S_IFREG
213 #endif
214 #if !defined(S_IFDIR) && defined(_S_IFDIR)
215 # define S_IFDIR _S_IFDIR
216 #endif
217 #if !defined(S_IFCHR) && defined(_S_IFCHR)
218 # define S_IFCHR _S_IFCHR
219 #endif
220 
221 #if !defined(S_ISREG)
222 # if defined(S_IFMT) && defined(S_IFREG)
223 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
224 # else
225 # error "S_ISREG"
226 # endif
227 #endif
228 #if !defined(S_ISDIR)
229 # if defined(S_IFMT) && defined(S_IFDIR)
230 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
231 # else
232 # error "S_ISDIR"
233 # endif
234 #endif
235 #if !defined(S_ISCHR)
236 # if defined(S_IFMT) && defined(S_IFCHR)
237 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
238 # endif
239 #endif
240 
241 
242 // avoid warnings about shadowing global functions
243 #undef index
244 #define basename upx_basename
245 #define index upx_index
246 #define outp upx_outp
247 
248 #undef PAGE_MASK
249 #undef PAGE_SIZE
250 
251 #if !defined(O_BINARY) || (O_BINARY+0 == 0)
252 # if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
253 # error "missing O_BINARY"
254 # endif
255 #endif
256 #if !defined(O_BINARY)
257 # define O_BINARY 0
258 #endif
259 
260 #ifndef OPTIONS_VAR
261 # define OPTIONS_VAR "UPX"
262 #endif
263 
264 
265 /*************************************************************************
266 //
267 **************************************************************************/
268 
269 #if (ACC_CC_MSC)
270 #define __packed_struct(s) struct s {
271 #define __packed_struct_end() };
272 #else
273 #define __packed_struct(s) __acc_struct_packed(s)
274 #define __packed_struct_end() __acc_struct_packed_end()
275 #endif
276 
277 #define UNUSED(var) ACC_UNUSED(var)
278 #define COMPILE_TIME_ASSERT(e) ACC_COMPILE_TIME_ASSERT(e)
279 
280 #define __COMPILE_TIME_ASSERT_ALIGNOF_SIZEOF(a,b) { \
281  typedef a acc_tmp_a_t; typedef b acc_tmp_b_t; \
282  __packed_struct(acc_tmp_t) acc_tmp_b_t x; acc_tmp_a_t y; acc_tmp_b_t z; __packed_struct_end() \
283  COMPILE_TIME_ASSERT(sizeof(struct acc_tmp_t) == 2*sizeof(b)+sizeof(a)) \
284  COMPILE_TIME_ASSERT(sizeof(((acc_tmp_t*)0)->x)+sizeof(((acc_tmp_t*)0)->y)+sizeof(((acc_tmp_t*)0)->z) == 2*sizeof(b)+sizeof(a)) \
285  }
286 #if defined(__acc_alignof)
287 # define __COMPILE_TIME_ASSERT_ALIGNOF(a,b) \
288  __COMPILE_TIME_ASSERT_ALIGNOF_SIZEOF(a,b) \
289  COMPILE_TIME_ASSERT(__acc_alignof(a) == sizeof(b))
290 #else
291 # define __COMPILE_TIME_ASSERT_ALIGNOF(a,b) \
292  __COMPILE_TIME_ASSERT_ALIGNOF_SIZEOF(a,b)
293 #endif
294 #define COMPILE_TIME_ASSERT_ALIGNED1(a) __COMPILE_TIME_ASSERT_ALIGNOF(a,char)
295 
296 #define TABLESIZE(table) ((sizeof(table)/sizeof((table)[0])))
297 
298 
299 template <class T>
300 inline T ALIGN_DOWN(const T& a, const T& b) { T r; r = (a / b) * b; return r; }
301 template <class T>
302 inline T ALIGN_UP (const T& a, const T& b) { T r; r = ((a + b - 1) / b) * b; return r; }
303 template <class T>
304 inline T ALIGN_GAP (const T& a, const T& b) { T r; r = ALIGN_UP(a, b) - a; return r; }
305 
306 template <class T>
307 inline const T& UPX_MAX(const T& a, const T& b) { if (a < b) return b; return a; }
308 template <class T>
309 inline const T& UPX_MIN(const T& a, const T& b) { if (a < b) return a; return b; }
310 
311 
312 // An Array allocates memory on the heap, but automatically
313 // gets destructed when leaving scope or on exceptions.
314 #define Array(type, var, size) \
315  MemBuffer var ## _membuf(mem_size(sizeof(type), size)); \
316  type * const var = ACC_STATIC_CAST(type *, var ## _membuf.getVoidPtr())
317 
318 #define ByteArray(var, size) Array(unsigned char, var, size)
319 
321 {
322 protected:
323  inline noncopyable() {}
324  inline ~noncopyable() {}
325 private:
326  noncopyable(const noncopyable &); // undefined
327  const noncopyable& operator=(const noncopyable &); // undefined
328 };
329 
330 
331 /*************************************************************************
332 // constants
333 **************************************************************************/
334 
335 /* exit codes of this program: 0 ok, 1 error, 2 warning */
336 #define EXIT_OK 0
337 #define EXIT_ERROR 1
338 #define EXIT_WARN 2
339 
340 #define EXIT_USAGE 1
341 #define EXIT_FILE_READ 1
342 #define EXIT_FILE_WRITE 1
343 #define EXIT_MEMORY 1
344 #define EXIT_CHECKSUM 1
345 #define EXIT_INIT 1
346 #define EXIT_INTERNAL 1
347 
348 
349 // magic constants for patching
350 #define UPX_MAGIC_LE32 0x21585055 /* "UPX!" */
351 #define UPX_MAGIC2_LE32 0xD5D0D8A1
352 #define UPX_MAGIC3_LE32 0x21464C45 /* "ELF!" */
353 #define UPX_MAGIC4_LE32 0xB5A496F5 /* magic for hajime */
354 
355 
356 // upx_compress() error codes
357 #define UPX_E_OK (0)
358 #define UPX_E_ERROR (-1)
359 #define UPX_E_OUT_OF_MEMORY (-2)
360 #define UPX_E_NOT_COMPRESSIBLE (-3)
361 #define UPX_E_INPUT_OVERRUN (-4)
362 #define UPX_E_OUTPUT_OVERRUN (-5)
363 #define UPX_E_LOOKBEHIND_OVERRUN (-6)
364 #define UPX_E_EOF_NOT_FOUND (-7)
365 #define UPX_E_INPUT_NOT_CONSUMED (-8)
366 #define UPX_E_NOT_YET_IMPLEMENTED (-9)
367 #define UPX_E_INVALID_ARGUMENT (-10)
368 
369 
370 // Executable formats. Note: big endian types are >= 128.
371 #define UPX_F_DOS_COM 1
372 #define UPX_F_DOS_SYS 2
373 #define UPX_F_DOS_EXE 3
374 #define UPX_F_DJGPP2_COFF 4
375 #define UPX_F_WATCOM_LE 5
376 #define UPX_F_VXD_LE 6
377 #define UPX_F_DOS_EXEH 7 /* OBSOLETE */
378 #define UPX_F_TMT_ADAM 8
379 #define UPX_F_WIN32_PE 9
380 #define UPX_F_LINUX_i386 10
381 #define UPX_F_WIN16_NE 11
382 #define UPX_F_LINUX_ELF_i386 12
383 #define UPX_F_LINUX_SEP_i386 13
384 #define UPX_F_LINUX_SH_i386 14
385 #define UPX_F_VMLINUZ_i386 15
386 #define UPX_F_BVMLINUZ_i386 16
387 #define UPX_F_ELKS_8086 17
388 #define UPX_F_PS1_EXE 18
389 #define UPX_F_VMLINUX_i386 19
390 #define UPX_F_LINUX_ELFI_i386 20
391 #define UPX_F_WINCE_ARM_PE 21
392 #define UPX_F_LINUX_ELF64_AMD 22
393 #define UPX_F_LINUX_ELF32_ARMEL 23
394 #define UPX_F_BSD_i386 24
395 #define UPX_F_BSD_ELF_i386 25
396 #define UPX_F_BSD_SH_i386 26
397 
398 #define UPX_F_VMLINUX_AMD64 27
399 #define UPX_F_VMLINUX_ARMEL 28
400 #define UPX_F_MACH_i386 29
401 #define UPX_F_LINUX_ELF32_MIPSEL 30
402 #define UPX_F_VMLINUZ_ARMEL 31
403 #define UPX_F_MACH_ARMEL 32
404 
405 #define UPX_F_DYLIB_i386 33
406 #define UPX_F_MACH_AMD64 34
407 #define UPX_F_DYLIB_AMD64 35
408 
409 #define UPX_F_WIN64_PEP 36
410 
411 #define UPX_F_MACH_ARM64EL 37
412 
413 #define UPX_F_MACH_PPC64LE 38
414 #define UPX_F_LINUX_ELFPPC64LE 39
415 #define UPX_F_VMLINUX_PPC64LE 40
416 #define UPX_F_DYLIB_PPC64LE 41
417 
418 #define UPX_F_PLAIN_TEXT 127 // FIXME: what is this ??
419 
420 #define UPX_F_ATARI_TOS 129
421 #define UPX_F_SOLARIS_SPARC 130
422 #define UPX_F_MACH_PPC32 131
423 #define UPX_F_LINUX_ELFPPC32 132
424 #define UPX_F_LINUX_ELF32_ARMEB 133
425 #define UPX_F_MACH_FAT 134
426 #define UPX_F_VMLINUX_ARMEB 135
427 #define UPX_F_VMLINUX_PPC32 136
428 #define UPX_F_LINUX_ELF32_MIPSEB 137
429 #define UPX_F_DYLIB_PPC32 138
430 
431 
432 // compression methods
433 #define M_ALL (-1)
434 #define M_END (-2)
435 #define M_NONE (-3)
436 #define M_SKIP (-4)
437 #define M_ULTRA_BRUTE (-5)
438 // compression methods - DO NOT CHANGE
439 #define M_NRV2B_LE32 2
440 #define M_NRV2B_8 3
441 #define M_NRV2B_LE16 4
442 #define M_NRV2D_LE32 5
443 #define M_NRV2D_8 6
444 #define M_NRV2D_LE16 7
445 #define M_NRV2E_LE32 8
446 #define M_NRV2E_8 9
447 #define M_NRV2E_LE16 10
448 //#define M_CL1B_LE32 11
449 //#define M_CL1B_8 12
450 //#define M_CL1B_LE16 13
451 #define M_LZMA 14
452 #define M_DEFLATE 15 /* zlib */
453 
454 #define M_IS_NRV2B(x) ((x) >= M_NRV2B_LE32 && (x) <= M_NRV2B_LE16)
455 #define M_IS_NRV2D(x) ((x) >= M_NRV2D_LE32 && (x) <= M_NRV2D_LE16)
456 #define M_IS_NRV2E(x) ((x) >= M_NRV2E_LE32 && (x) <= M_NRV2E_LE16)
457 //#define M_IS_CL1B(x) ((x) >= M_CL1B_LE32 && (x) <= M_CL1B_LE16)
458 #define M_IS_LZMA(x) (((x) & 255) == M_LZMA)
459 #define M_IS_DEFLATE(x) ((x) == M_DEFLATE)
460 
461 
462 // filters
463 #define FT_END (-1)
464 #define FT_NONE (-2)
465 #define FT_SKIP (-3)
466 #define FT_ULTRA_BRUTE (-4)
467 
468 
469 /*************************************************************************
470 // compression - callback_t
471 **************************************************************************/
472 
473 struct upx_callback_t;
475 typedef void (__acc_cdecl *upx_progress_func_t)
476  (upx_callback_p, unsigned, unsigned);
477 
479 {
480  upx_progress_func_t nprogress;
481  void *user;
482 
483  void reset() { memset(this, 0, sizeof(*this)); }
484 };
485 
486 
487 /*************************************************************************
488 // compression - config_t
489 **************************************************************************/
490 
491 template <class T, T default_value, T min_value, T max_value>
492 struct OptVar
493 {
494  typedef T value_type;
495  static const T default_value_c = default_value;
496  static const T min_value_c = min_value;
497  static const T max_value_c = max_value;
498 
499  void assertValue() const {
500  // info: this generates annoying warnings "unsigned >= 0 is always true"
501  //assert(v >= min_value_c);
502  assert(v == min_value_c || v >= min_value_c + 1);
503  assert(v <= max_value_c);
504  }
505 
506  OptVar() : v(default_value), is_set(0) { }
507  OptVar& operator= (const T other) {
508  v = other; is_set += 1;
509  assertValue();
510  return *this;
511  }
512 
513  void reset() { v = default_value; is_set = 0; }
514  operator T () const { return v; }
515 
516  T v;
517  unsigned is_set;
518 };
519 
520 
521 // optional assignments
522 template <class T, T a, T b, T c>
523 inline void oassign(OptVar<T,a,b,c> &self, const OptVar<T,a,b,c> &other) {
524  if (other.is_set) { self.v = other.v; self.is_set += 1; }
525 }
526 template <class T, T a, T b, T c>
527 inline void oassign(unsigned &v, const OptVar<T,a,b,c> &other) {
528  if (other.is_set) { v = other.v; }
529 }
530 
531 
533 {
539 
540  pos_bits_t pos_bits; // pb
541  lit_pos_bits_t lit_pos_bits; // lp
542  lit_context_bits_t lit_context_bits; // lc
543  dict_size_t dict_size;
544  unsigned fast_mode;
545  num_fast_bytes_t num_fast_bytes;
546  unsigned match_finder_cycles;
547 
548  unsigned max_num_probs;
549 
550  void reset();
551 };
552 
553 
554 struct ucl_compress_config_t : public REAL_ucl_compress_config_t
555 {
556  void reset() { memset(this, 0xff, sizeof(*this)); }
557 };
558 
559 
561 {
565 
566  mem_level_t mem_level; // ml
567  window_bits_t window_bits; // wb
568  strategy_t strategy; // st
569 
570  void reset();
571 };
572 
573 
575 {
576  lzma_compress_config_t conf_lzma;
577  ucl_compress_config_t conf_ucl;
578  zlib_compress_config_t conf_zlib;
579  void reset() { conf_lzma.reset(); conf_ucl.reset(); conf_zlib.reset(); }
580 };
581 
582 #define NULL_cconf ((upx_compress_config_t *) NULL)
583 
584 
585 /*************************************************************************
586 // compression - result_t
587 **************************************************************************/
588 
590 {
591  unsigned pos_bits; // pb
592  unsigned lit_pos_bits; // lp
593  unsigned lit_context_bits; // lc
594  unsigned dict_size;
595  unsigned fast_mode;
596  unsigned num_fast_bytes;
597  unsigned match_finder_cycles;
598  unsigned num_probs; // (computed result)
599 
600  void reset() { memset(this, 0, sizeof(*this)); }
601 };
602 
603 
605 {
606  ucl_uint result[16];
607 
608  void reset() { memset(this, 0, sizeof(*this)); }
609 };
610 
611 
613 {
614  unsigned dummy;
615 
616  void reset() { memset(this, 0, sizeof(*this)); }
617 };
618 
619 
621 {
622  // debug
623  int method, level;
624  unsigned u_len, c_len;
625 
626  lzma_compress_result_t result_lzma;
627  ucl_compress_result_t result_ucl;
628  zlib_compress_result_t result_zlib;
629 
630  void reset() {
631  memset(this, 0, sizeof(*this));
632  result_lzma.reset(); result_ucl.reset(); result_zlib.reset();
633  }
634 };
635 
636 
637 /*************************************************************************
638 // globals
639 **************************************************************************/
640 
641 #include "snprintf.h" // must get included first!
642 #include "stdcxx.h"
643 #include "options.h"
644 #include "except.h"
645 #include "bele.h"
646 #include "util.h"
647 #include "console.h"
648 
649 
650 // classes
651 class ElfLinker;
652 typedef ElfLinker Linker;
653 
654 
655 // main.cpp
656 extern const char *progname;
657 bool set_exit_code(int ec);
658 #if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
659 void e_exit(int ec) __attribute__((__noreturn__));
660 #else
661 void e_exit(int ec);
662 #endif
663 
664 
665 // msg.cpp
666 void printSetNl(int need_nl);
667 void printClearLine(FILE *f = NULL);
668 void printErr(const char *iname, const Throwable *e);
669 void printUnhandledException(const char *iname, const std::exception *e);
670 #if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
671 void __acc_cdecl_va printErr(const char *iname, const char *format, ...)
672  __attribute__((__format__(__printf__,2,3)));
673 void __acc_cdecl_va printWarn(const char *iname, const char *format, ...)
674  __attribute__((__format__(__printf__,2,3)));
675 #else
676 void __acc_cdecl_va printErr(const char *iname, const char *format, ...);
677 void __acc_cdecl_va printWarn(const char *iname, const char *format, ...);
678 #endif
679 
680 #if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
681 void __acc_cdecl_va infoWarning(const char *format, ...)
682  __attribute__((__format__(__printf__,1,2)));
683 void __acc_cdecl_va infoHeader(const char *format, ...)
684  __attribute__((__format__(__printf__,1,2)));
685 void __acc_cdecl_va info(const char *format, ...)
686  __attribute__((__format__(__printf__,1,2)));
687 #else
688 void __acc_cdecl_va infoWarning(const char *format, ...);
689 void __acc_cdecl_va infoHeader(const char *format, ...);
690 void __acc_cdecl_va info(const char *format, ...);
691 #endif
692 void infoHeader();
693 void infoWriting(const char *what, long size);
694 
695 
696 // work.cpp
697 void do_one_file(const char *iname, char *oname);
698 void do_files(int i, int argc, char *argv[]);
699 
700 
701 // help.cpp
702 extern const char gitrev[];
703 void show_head(void);
704 void show_help(int verbose=0);
705 void show_license(void);
706 void show_usage(void);
707 void show_version(int);
708 
709 
710 // compress.cpp
711 unsigned upx_adler32(const void *buf, unsigned len, unsigned adler=1);
712 unsigned upx_crc32(const void *buf, unsigned len, unsigned crc=0);
713 
714 int upx_compress ( const upx_bytep src, unsigned src_len,
715  upx_bytep dst, unsigned* dst_len,
716  upx_callback_p cb,
717  int method, int level,
718  const upx_compress_config_t *cconf,
719  upx_compress_result_t *cresult );
720 int upx_decompress ( const upx_bytep src, unsigned src_len,
721  upx_bytep dst, unsigned* dst_len,
722  int method,
723  const upx_compress_result_t *cresult );
724 int upx_test_overlap ( const upx_bytep buf,
725  const upx_bytep tbuf,
726  unsigned src_off, unsigned src_len,
727  unsigned* dst_len,
728  int method,
729  const upx_compress_result_t *cresult );
730 
731 
732 #if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
733 # if defined(INVALID_HANDLE_VALUE) || defined(MAKEWORD) || defined(RT_CURSOR)
734 # error "something pulled in <windows.h>"
735 # endif
736 #endif
737 
738 
739 #endif /* already included */
740 
741 /* vim:set ts=4 sw=4 et: */
Definition: conf.h:554
Definition: linker.h:35
Definition: conf.h:620
Definition: conf.h:492
Definition: conf.h:612
Definition: conf.h:532
Definition: conf.h:560
Definition: conf.h:604
Definition: conf.h:574
Definition: conf.h:320
Definition: conf.h:478
Definition: conf.h:589