mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Cleanups.
committer: mfx <mfx> 1090594763 +0000
This commit is contained in:
parent
14ced962db
commit
ed9057ca83
|
@ -83,4 +83,6 @@ include $(srcdir)/Makefile.bld
|
|||
|
||||
include $(srcdir)/Makedefs.dep
|
||||
|
||||
$(OBJECTS): miniacc.h
|
||||
|
||||
# vi:nowrap
|
||||
|
|
16
src/bele.h
16
src/bele.h
|
@ -93,8 +93,8 @@ inline void set_be32(void *bb, unsigned v)
|
|||
|
||||
inline unsigned get_le16(const void *bb)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
return * (const unsigned short *) bb;
|
||||
#if defined(ACC_GET_LE16)
|
||||
return ACC_GET_LE16(bb);
|
||||
#else
|
||||
const unsigned char* b = (const unsigned char*) bb;
|
||||
unsigned v;
|
||||
|
@ -106,8 +106,8 @@ inline unsigned get_le16(const void *bb)
|
|||
|
||||
inline void set_le16(void *bb, unsigned v)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
(* (unsigned short *) bb) = (unsigned short) (v & 0xffff);
|
||||
#if defined(ACC_SET_LE16)
|
||||
ACC_SET_LE16(bb, v);
|
||||
#else
|
||||
unsigned char* b = (unsigned char*) bb;
|
||||
b[0] = (unsigned char) (v >> 0);
|
||||
|
@ -137,8 +137,8 @@ inline void set_le24(void *bb, unsigned v)
|
|||
|
||||
inline unsigned get_le32(const void *bb)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
return * (const acc_uint32e_t *) bb;
|
||||
#if defined(ACC_GET_LE32)
|
||||
return ACC_GET_LE32(bb);
|
||||
#else
|
||||
const unsigned char* b = (const unsigned char*) bb;
|
||||
unsigned v;
|
||||
|
@ -152,8 +152,8 @@ inline unsigned get_le32(const void *bb)
|
|||
|
||||
inline void set_le32(void *bb, unsigned v)
|
||||
{
|
||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_IA32)
|
||||
(* (acc_uint32e_t *) bb) = v;
|
||||
#if defined(ACC_SET_LE32)
|
||||
ACC_SET_LE32(bb, v);
|
||||
#else
|
||||
unsigned char* b = (unsigned char*) bb;
|
||||
b[0] = (unsigned char) (v >> 0);
|
||||
|
|
|
@ -1028,14 +1028,17 @@ static void first_options(int argc, char **argv)
|
|||
// assert a sane architecture and compiler
|
||||
**************************************************************************/
|
||||
|
||||
#define ACC_WANT_ACC_CHK_CH 1
|
||||
#undef ACCCHK_ASSERT
|
||||
#include "miniacc.h"
|
||||
|
||||
void upx_sanity_check(void)
|
||||
{
|
||||
#define ACC_WANT_ACC_CHK_CH 1
|
||||
#undef ACCCHK_ASSERT
|
||||
#define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr)
|
||||
#include "miniacc.h"
|
||||
#undef ACC_WANT_ACC_CHK_CH
|
||||
#undef ACCCHK_ASSERT
|
||||
#undef ACC_WANT_ACC_CHK_CH
|
||||
|
||||
COMPILE_TIME_ASSERT(sizeof(char) == 1)
|
||||
COMPILE_TIME_ASSERT(sizeof(short) == 2)
|
||||
|
|
216
src/miniacc.h
216
src/miniacc.h
|
@ -1,5 +1,7 @@
|
|||
/* ACC -- Automatic Compiler Configuration
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||
|
@ -11,9 +13,20 @@
|
|||
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
This software is a copyrighted work licensed under the terms of
|
||||
the GNU General Public License. Please consult the file "COPYING"
|
||||
for details.
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
and/or modify them under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
|
@ -22,7 +35,7 @@
|
|||
|
||||
#ifndef __ACC_H_INCLUDED
|
||||
#define __ACC_H_INCLUDED 1
|
||||
#define ACC_VERSION 20040722L
|
||||
#define ACC_VERSION 20040723L
|
||||
#if !defined(ACC_CONFIG_INCLUDE)
|
||||
# define ACC_CONFIG_INCLUDE(file) file
|
||||
#endif
|
||||
|
@ -713,6 +726,11 @@ extern "C" {
|
|||
#else
|
||||
# error "unknown memory model"
|
||||
#endif
|
||||
#if (ACC_CC_GNUC >= 0x020800ul)
|
||||
# define __acc_gnuc_extension__ __extension__
|
||||
#else
|
||||
# define __acc_gnuc_extension__
|
||||
#endif
|
||||
#if (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_PGI)
|
||||
# define acc_alignof(e) __alignof__(e)
|
||||
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 700))
|
||||
|
@ -833,6 +851,66 @@ extern "C" {
|
|||
# error "check your compiler installation: ULONG_MAX"
|
||||
# endif
|
||||
#endif
|
||||
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC)
|
||||
# elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
# define __acc_cdecl __cdecl
|
||||
# define __acc_cdecl_atexit
|
||||
# define __acc_cdecl_main __cdecl
|
||||
# if (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
||||
# define __acc_cdecl_qsort __pascal
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
|
||||
# define __acc_cdecl_qsort _stdcall
|
||||
# else
|
||||
# define __acc_cdecl_qsort __cdecl
|
||||
# endif
|
||||
# elif (ACC_CC_WATCOMC)
|
||||
# define __acc_cdecl __cdecl
|
||||
# else
|
||||
# define __acc_cdecl __cdecl
|
||||
# define __acc_cdecl_atexit __cdecl
|
||||
# define __acc_cdecl_main __cdecl
|
||||
# define __acc_cdecl_qsort __cdecl
|
||||
# endif
|
||||
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC || ACC_CC_WATCOMC)
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
||||
# define __acc_cdecl_sighandler __pascal
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
|
||||
# define __acc_cdecl_sighandler _stdcall
|
||||
# elif (ACC_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE)
|
||||
# define __acc_cdecl_sighandler __clrcall
|
||||
# elif (ACC_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700))
|
||||
# if defined(_DLL)
|
||||
# define __acc_cdecl_sighandler _far _cdecl _loadds
|
||||
# elif defined(_MT)
|
||||
# define __acc_cdecl_sighandler _far _cdecl
|
||||
# else
|
||||
# define __acc_cdecl_sighandler _cdecl
|
||||
# endif
|
||||
# else
|
||||
# define __acc_cdecl_sighandler __cdecl
|
||||
# endif
|
||||
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||
# define __acc_cdecl cdecl
|
||||
#endif
|
||||
#if !defined(__acc_cdecl)
|
||||
# define __acc_cdecl
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_atexit)
|
||||
# define __acc_cdecl_atexit
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_main)
|
||||
# define __acc_cdecl_main
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_qsort)
|
||||
# define __acc_cdecl_qsort
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_sighandler)
|
||||
# define __acc_cdecl_sighandler
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_va)
|
||||
# define __acc_cdecl_va __acc_cdecl
|
||||
#endif
|
||||
#if (ACC_OS_CYGWIN || (ACC_OS_EMX && defined(__RSXNT__)) || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# if (ACC_CC_WATCOMC && (__WATCOMC__ < 1000))
|
||||
# elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
|
||||
|
@ -1412,11 +1490,6 @@ extern "C" {
|
|||
#endif
|
||||
#if defined(ACC_CONFIG_NO_TYPE)
|
||||
#else
|
||||
#if (ACC_CC_GNUC >= 0x020800ul)
|
||||
# define __acc_gnuc_extension__ __extension__
|
||||
#else
|
||||
# define __acc_gnuc_extension__
|
||||
#endif
|
||||
#if (SIZEOF_LONG_LONG > 0)
|
||||
__acc_gnuc_extension__ typedef long long acc_llong_t;
|
||||
#endif
|
||||
|
@ -1606,66 +1679,6 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
|
|||
# error "integral constants"
|
||||
# endif
|
||||
#endif
|
||||
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC)
|
||||
# elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
# define __acc_cdecl __cdecl
|
||||
# define __acc_cdecl_atexit
|
||||
# define __acc_cdecl_main __cdecl
|
||||
# if (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
||||
# define __acc_cdecl_qsort __pascal
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
|
||||
# define __acc_cdecl_qsort _stdcall
|
||||
# else
|
||||
# define __acc_cdecl_qsort __cdecl
|
||||
# endif
|
||||
# elif (ACC_CC_WATCOMC)
|
||||
# define __acc_cdecl __cdecl
|
||||
# else
|
||||
# define __acc_cdecl __cdecl
|
||||
# define __acc_cdecl_atexit __cdecl
|
||||
# define __acc_cdecl_main __cdecl
|
||||
# define __acc_cdecl_qsort __cdecl
|
||||
# endif
|
||||
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC || ACC_CC_WATCOMC)
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
||||
# define __acc_cdecl_sighandler __pascal
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
|
||||
# define __acc_cdecl_sighandler _stdcall
|
||||
# elif (ACC_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE)
|
||||
# define __acc_cdecl_sighandler __clrcall
|
||||
# elif (ACC_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700))
|
||||
# if defined(_DLL)
|
||||
# define __acc_cdecl_sighandler _far _cdecl _loadds
|
||||
# elif defined(_MT)
|
||||
# define __acc_cdecl_sighandler _far _cdecl
|
||||
# else
|
||||
# define __acc_cdecl_sighandler _cdecl
|
||||
# endif
|
||||
# else
|
||||
# define __acc_cdecl_sighandler __cdecl
|
||||
# endif
|
||||
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||
# define __acc_cdecl cdecl
|
||||
#endif
|
||||
#if !defined(__acc_cdecl)
|
||||
# define __acc_cdecl
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_atexit)
|
||||
# define __acc_cdecl_atexit
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_main)
|
||||
# define __acc_cdecl_main
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_qsort)
|
||||
# define __acc_cdecl_qsort
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_sighandler)
|
||||
# define __acc_cdecl_sighandler
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_va)
|
||||
# define __acc_cdecl_va __acc_cdecl
|
||||
#endif
|
||||
#if (ACC_BROKEN_CDECL_ALT_SYNTAX)
|
||||
typedef void __acc_cdecl_sighandler (*acc_sighandler_t)(int);
|
||||
#elif defined(RETSIGTYPE)
|
||||
|
@ -1676,11 +1689,6 @@ typedef void (__acc_cdecl_sighandler *acc_sighandler_t)(int);
|
|||
#endif
|
||||
#endif
|
||||
#if defined(ACC_WANT_ACC_TYPE_H)
|
||||
#if (ACC_CC_GNUC >= 0x020800ul)
|
||||
# define __acc_gnuc_extension__ __extension__
|
||||
#else
|
||||
# define __acc_gnuc_extension__
|
||||
#endif
|
||||
#if (SIZEOF_LONG_LONG > 0)
|
||||
__acc_gnuc_extension__ typedef long long acc_llong_t;
|
||||
#endif
|
||||
|
@ -1870,66 +1878,6 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
|
|||
# error "integral constants"
|
||||
# endif
|
||||
#endif
|
||||
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC)
|
||||
# elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||
# define __acc_cdecl __cdecl
|
||||
# define __acc_cdecl_atexit
|
||||
# define __acc_cdecl_main __cdecl
|
||||
# if (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
||||
# define __acc_cdecl_qsort __pascal
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
|
||||
# define __acc_cdecl_qsort _stdcall
|
||||
# else
|
||||
# define __acc_cdecl_qsort __cdecl
|
||||
# endif
|
||||
# elif (ACC_CC_WATCOMC)
|
||||
# define __acc_cdecl __cdecl
|
||||
# else
|
||||
# define __acc_cdecl __cdecl
|
||||
# define __acc_cdecl_atexit __cdecl
|
||||
# define __acc_cdecl_main __cdecl
|
||||
# define __acc_cdecl_qsort __cdecl
|
||||
# endif
|
||||
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC || ACC_CC_WATCOMC)
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
||||
# define __acc_cdecl_sighandler __pascal
|
||||
# elif (ACC_OS_OS2 && (ACC_CC_ZORTECHC))
|
||||
# define __acc_cdecl_sighandler _stdcall
|
||||
# elif (ACC_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE)
|
||||
# define __acc_cdecl_sighandler __clrcall
|
||||
# elif (ACC_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700))
|
||||
# if defined(_DLL)
|
||||
# define __acc_cdecl_sighandler _far _cdecl _loadds
|
||||
# elif defined(_MT)
|
||||
# define __acc_cdecl_sighandler _far _cdecl
|
||||
# else
|
||||
# define __acc_cdecl_sighandler _cdecl
|
||||
# endif
|
||||
# else
|
||||
# define __acc_cdecl_sighandler __cdecl
|
||||
# endif
|
||||
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||
# define __acc_cdecl cdecl
|
||||
#endif
|
||||
#if !defined(__acc_cdecl)
|
||||
# define __acc_cdecl
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_atexit)
|
||||
# define __acc_cdecl_atexit
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_main)
|
||||
# define __acc_cdecl_main
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_qsort)
|
||||
# define __acc_cdecl_qsort
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_sighandler)
|
||||
# define __acc_cdecl_sighandler
|
||||
#endif
|
||||
#if !defined(__acc_cdecl_va)
|
||||
# define __acc_cdecl_va __acc_cdecl
|
||||
#endif
|
||||
#if (ACC_BROKEN_CDECL_ALT_SYNTAX)
|
||||
typedef void __acc_cdecl_sighandler (*acc_sighandler_t)(int);
|
||||
#elif defined(RETSIGTYPE)
|
||||
|
|
Loading…
Reference in New Issue
Block a user