mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Added support for Intel C++ 7.0.
committer: mfx <mfx> 1042686101 +0000
This commit is contained in:
parent
888ac8a220
commit
e96ad21db1
23
src/Makefile
23
src/Makefile
|
@ -217,6 +217,29 @@ CHMOD_EXE = chmod 755 $@
|
||||||
endif # linux
|
endif # linux
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
### Linux/i386 with Intel C++ 7.0
|
||||||
|
###
|
||||||
|
|
||||||
|
ifeq ($(target),linux-intelc70)
|
||||||
|
CC = icc
|
||||||
|
CXX = icc
|
||||||
|
CFLAGS_OUTPUT = -o $@
|
||||||
|
LINK_EXE_OUTPUT = -o $@
|
||||||
|
|
||||||
|
DEFS += '-DUPX_CONFIG_H="config_h/linux.h"'
|
||||||
|
CFLAGS = $(CFLAGS_WERROR)
|
||||||
|
ifeq ($(DEBUG),1)
|
||||||
|
CFLAGS += -g -O0
|
||||||
|
else
|
||||||
|
CFLAGS += -O2
|
||||||
|
endif
|
||||||
|
CXXFLAGS_2 += -fno-rtti
|
||||||
|
LDFLAGS += -Wl,-Map,$T.map
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
### Linux cross compilers
|
### Linux cross compilers
|
||||||
###
|
###
|
||||||
|
|
32
src/bele.h
32
src/bele.h
|
@ -229,7 +229,7 @@ public:
|
||||||
BE16& operator &= (unsigned v) { set_be16(d, get_be16(d) & v); return *this; }
|
BE16& operator &= (unsigned v) { set_be16(d, get_be16(d) & v); return *this; }
|
||||||
BE16& operator |= (unsigned v) { set_be16(d, get_be16(d) | v); return *this; }
|
BE16& operator |= (unsigned v) { set_be16(d, get_be16(d) | v); return *this; }
|
||||||
|
|
||||||
operator const unsigned () const { return get_be16(d); }
|
operator unsigned () const { return get_be16(d); }
|
||||||
}
|
}
|
||||||
__attribute_packed;
|
__attribute_packed;
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ public:
|
||||||
BE32& operator &= (unsigned v) { set_be32(d, get_be32(d) & v); return *this; }
|
BE32& operator &= (unsigned v) { set_be32(d, get_be32(d) & v); return *this; }
|
||||||
BE32& operator |= (unsigned v) { set_be32(d, get_be32(d) | v); return *this; }
|
BE32& operator |= (unsigned v) { set_be32(d, get_be32(d) | v); return *this; }
|
||||||
|
|
||||||
operator const unsigned () const { return get_be32(d); }
|
operator unsigned () const { return get_be32(d); }
|
||||||
}
|
}
|
||||||
__attribute_packed;
|
__attribute_packed;
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ public:
|
||||||
LE16& operator &= (unsigned v) { set_le16(d, get_le16(d) & v); return *this; }
|
LE16& operator &= (unsigned v) { set_le16(d, get_le16(d) & v); return *this; }
|
||||||
LE16& operator |= (unsigned v) { set_le16(d, get_le16(d) | v); return *this; }
|
LE16& operator |= (unsigned v) { set_le16(d, get_le16(d) | v); return *this; }
|
||||||
|
|
||||||
operator const unsigned () const { return get_le16(d); }
|
operator unsigned () const { return get_le16(d); }
|
||||||
}
|
}
|
||||||
__attribute_packed;
|
__attribute_packed;
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ public:
|
||||||
LE32& operator &= (unsigned v) { set_le32(d, get_le32(d) & v); return *this; }
|
LE32& operator &= (unsigned v) { set_le32(d, get_le32(d) & v); return *this; }
|
||||||
LE32& operator |= (unsigned v) { set_le32(d, get_le32(d) | v); return *this; }
|
LE32& operator |= (unsigned v) { set_le32(d, get_le32(d) | v); return *this; }
|
||||||
|
|
||||||
operator const unsigned () const { return get_le32(d); }
|
operator unsigned () const { return get_le32(d); }
|
||||||
}
|
}
|
||||||
__attribute_packed;
|
__attribute_packed;
|
||||||
|
|
||||||
|
@ -294,44 +294,44 @@ __attribute_packed;
|
||||||
|
|
||||||
inline bool operator < (const BE16& v1, const BE16& v2)
|
inline bool operator < (const BE16& v1, const BE16& v2)
|
||||||
{
|
{
|
||||||
return (const unsigned)v1 < (const unsigned)v2;
|
return (unsigned)v1 < (unsigned)v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator < (const BE32& v1, const BE32& v2)
|
inline bool operator < (const BE32& v1, const BE32& v2)
|
||||||
{
|
{
|
||||||
return (const unsigned)v1 < (const unsigned)v2;
|
return (unsigned)v1 < (unsigned)v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator < (const LE16& v1, const LE16& v2)
|
inline bool operator < (const LE16& v1, const LE16& v2)
|
||||||
{
|
{
|
||||||
return (const unsigned)v1 < (const unsigned)v2;
|
return (unsigned)v1 < (unsigned)v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator < (const LE32& v1, const LE32& v2)
|
inline bool operator < (const LE32& v1, const LE32& v2)
|
||||||
{
|
{
|
||||||
return (const unsigned)v1 < (const unsigned)v2;
|
return (unsigned)v1 < (unsigned)v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* operator + (T* ptr, const BE16& v) { return ptr + (const unsigned) v; }
|
inline T* operator + (T* ptr, const BE16& v) { return ptr + (unsigned) v; }
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* operator - (T* ptr, const BE16& v) { return ptr - (const unsigned) v; }
|
inline T* operator - (T* ptr, const BE16& v) { return ptr - (unsigned) v; }
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* operator + (T* ptr, const BE32& v) { return ptr + (const unsigned) v; }
|
inline T* operator + (T* ptr, const BE32& v) { return ptr + (unsigned) v; }
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* operator - (T* ptr, const BE32& v) { return ptr - (const unsigned) v; }
|
inline T* operator - (T* ptr, const BE32& v) { return ptr - (unsigned) v; }
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* operator + (T* ptr, const LE16& v) { return ptr + (const unsigned) v; }
|
inline T* operator + (T* ptr, const LE16& v) { return ptr + (unsigned) v; }
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* operator - (T* ptr, const LE16& v) { return ptr - (const unsigned) v; }
|
inline T* operator - (T* ptr, const LE16& v) { return ptr - (unsigned) v; }
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* operator + (T* ptr, const LE32& v) { return ptr + (const unsigned) v; }
|
inline T* operator + (T* ptr, const LE32& v) { return ptr + (unsigned) v; }
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T* operator - (T* ptr, const LE32& v) { return ptr - (const unsigned) v; }
|
inline T* operator - (T* ptr, const LE32& v) { return ptr - (unsigned) v; }
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -456,12 +456,10 @@ inline void operator delete[](void *p)
|
||||||
|
|
||||||
// An Array allocates memory on the heap, but automatically
|
// An Array allocates memory on the heap, but automatically
|
||||||
// gets destructed when leaving scope or on exceptions.
|
// gets destructed when leaving scope or on exceptions.
|
||||||
// "var" is declared as a read-only reference to a pointer
|
|
||||||
// and behaves exactly like an array "var[]".
|
|
||||||
#define Array(type, var, size) \
|
#define Array(type, var, size) \
|
||||||
assert((int)(size) > 0); \
|
assert((int)(size) > 0); \
|
||||||
MemBuffer var ## _membuf((size)*(sizeof(type))); \
|
MemBuffer var ## _membuf((size)*(sizeof(type))); \
|
||||||
type * const & var = ((type *) var ## _membuf.getVoidPtr())
|
type * const var = ((type *) var ## _membuf.getVoidPtr())
|
||||||
|
|
||||||
#define ByteArray(var, size) Array(unsigned char, var, size)
|
#define ByteArray(var, size) Array(unsigned char, var, size)
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@ class MemBuffer;
|
||||||
|
|
||||||
class File
|
class File
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
File() { }
|
||||||
|
virtual ~File() { }
|
||||||
public:
|
public:
|
||||||
static void chmod(const char *name, int mode);
|
static void chmod(const char *name, int mode);
|
||||||
static void rename(const char *old_, const char *new_);
|
static void rename(const char *old_, const char *new_);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
virtual int canUnpack();
|
virtual int canUnpack();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const unsigned getCallTrickOffset() const { return 0x100; }
|
virtual unsigned getCallTrickOffset() const { return 0x100; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int buildLoader(const Filter *ft);
|
virtual int buildLoader(const Filter *ft);
|
||||||
|
|
|
@ -206,7 +206,7 @@ PackLinuxI386::pack4(OutputFile *fo, Filter &ft)
|
||||||
fo->write(shstrtab, sizeof(shstrtab));
|
fo->write(shstrtab, sizeof(shstrtab));
|
||||||
#endif // }
|
#endif // }
|
||||||
|
|
||||||
#define PAGE_MASK (~0<<12)
|
#define PAGE_MASK (~0u<<12)
|
||||||
// pre-calculate for benefit of runtime disappearing act via munmap()
|
// pre-calculate for benefit of runtime disappearing act via munmap()
|
||||||
elfout.phdr[0].p_memsz = PAGE_MASK & (~PAGE_MASK + elfout.phdr[0].p_filesz);
|
elfout.phdr[0].p_memsz = PAGE_MASK & (~PAGE_MASK + elfout.phdr[0].p_filesz);
|
||||||
#undef PAGE_MASK
|
#undef PAGE_MASK
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
virtual bool canPack();
|
virtual bool canPack();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const unsigned getCallTrickOffset() const { return 0; }
|
virtual unsigned getCallTrickOffset() const { return 0; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int buildLoader(const Filter *ft);
|
virtual int buildLoader(const Filter *ft);
|
||||||
|
|
|
@ -1063,13 +1063,13 @@ class Resource
|
||||||
upx_byte *name;
|
upx_byte *name;
|
||||||
upx_rnode *parent;
|
upx_rnode *parent;
|
||||||
};
|
};
|
||||||
struct upx_rbranch : upx_rnode
|
struct upx_rbranch : public upx_rnode
|
||||||
{
|
{
|
||||||
unsigned nc;
|
unsigned nc;
|
||||||
upx_rnode **children;
|
upx_rnode **children;
|
||||||
res_dir data;
|
res_dir data;
|
||||||
};
|
};
|
||||||
struct upx_rleaf : upx_rnode
|
struct upx_rleaf : public upx_rnode
|
||||||
{
|
{
|
||||||
upx_rleaf *next;
|
upx_rleaf *next;
|
||||||
unsigned newoffset;
|
unsigned newoffset;
|
||||||
|
|
|
@ -156,6 +156,12 @@
|
||||||
# define HAVE_MODE_T 1
|
# define HAVE_MODE_T 1
|
||||||
# define HAVE_CHMOD 1
|
# define HAVE_CHMOD 1
|
||||||
# define HAVE_UTIME 1
|
# define HAVE_UTIME 1
|
||||||
|
#elif defined(__INTEL_COMPILER)
|
||||||
|
# if (__INTEL_COMPILER >= 700)
|
||||||
|
# pragma warning(disable: 810) // #810: conversion from "A" to "B" may lose significant bits
|
||||||
|
# pragma warning(disable: 981) // #981: operands are evaluated in unspecified order
|
||||||
|
# pragma warning(disable: 1418) // #1418: external definition with no prior declaration
|
||||||
|
# endif
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
# define __UPX_CDECL __cdecl
|
# define __UPX_CDECL __cdecl
|
||||||
# define SIGTYPEENTRY __cdecl
|
# define SIGTYPEENTRY __cdecl
|
||||||
|
|
|
@ -704,7 +704,7 @@ char *textdomain(const char *)
|
||||||
#endif /* __linux__ && __GLIBC__ */
|
#endif /* __linux__ && __GLIBC__ */
|
||||||
|
|
||||||
|
|
||||||
}; // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user