diff --git a/src/Makefile b/src/Makefile index 9d9f73d0..6ee659e6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -217,6 +217,29 @@ CHMOD_EXE = chmod 755 $@ 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 ### diff --git a/src/bele.h b/src/bele.h index 6e92d0e5..1fb115ce 100644 --- a/src/bele.h +++ b/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; } - operator const unsigned () const { return get_be16(d); } + operator unsigned () const { return get_be16(d); } } __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; } - operator const unsigned () const { return get_be32(d); } + operator unsigned () const { return get_be32(d); } } __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; } - operator const unsigned () const { return get_le16(d); } + operator unsigned () const { return get_le16(d); } } __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; } - operator const unsigned () const { return get_le32(d); } + operator unsigned () const { return get_le32(d); } } __attribute_packed; @@ -294,44 +294,44 @@ __attribute_packed; 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) { - return (const unsigned)v1 < (const unsigned)v2; + return (unsigned)v1 < (unsigned)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) { - return (const unsigned)v1 < (const unsigned)v2; + return (unsigned)v1 < (unsigned)v2; } template -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 -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 -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 -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 -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 -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 -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 -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; } /************************************************************************* diff --git a/src/conf.h b/src/conf.h index 8c2d6a74..4a5d51b8 100644 --- a/src/conf.h +++ b/src/conf.h @@ -456,12 +456,10 @@ inline void operator delete[](void *p) // An Array allocates memory on the heap, but automatically // 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) \ assert((int)(size) > 0); \ 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) diff --git a/src/file.h b/src/file.h index 81dbf6d3..4c7d927c 100644 --- a/src/file.h +++ b/src/file.h @@ -38,6 +38,9 @@ class MemBuffer; class File { +protected: + File() { } + virtual ~File() { } public: static void chmod(const char *name, int mode); static void rename(const char *old_, const char *new_); diff --git a/src/p_com.h b/src/p_com.h index 5a6df225..d4d61edf 100644 --- a/src/p_com.h +++ b/src/p_com.h @@ -52,7 +52,7 @@ public: virtual int canUnpack(); protected: - virtual const unsigned getCallTrickOffset() const { return 0x100; } + virtual unsigned getCallTrickOffset() const { return 0x100; } protected: virtual int buildLoader(const Filter *ft); diff --git a/src/p_lx_exc.cpp b/src/p_lx_exc.cpp index 60f9605f..a69423f0 100644 --- a/src/p_lx_exc.cpp +++ b/src/p_lx_exc.cpp @@ -206,7 +206,7 @@ PackLinuxI386::pack4(OutputFile *fo, Filter &ft) fo->write(shstrtab, sizeof(shstrtab)); #endif // } -#define PAGE_MASK (~0<<12) +#define PAGE_MASK (~0u<<12) // pre-calculate for benefit of runtime disappearing act via munmap() elfout.phdr[0].p_memsz = PAGE_MASK & (~PAGE_MASK + elfout.phdr[0].p_filesz); #undef PAGE_MASK diff --git a/src/p_sys.h b/src/p_sys.h index 1ecca6de..84518056 100644 --- a/src/p_sys.h +++ b/src/p_sys.h @@ -46,7 +46,7 @@ public: virtual bool canPack(); protected: - virtual const unsigned getCallTrickOffset() const { return 0; } + virtual unsigned getCallTrickOffset() const { return 0; } protected: virtual int buildLoader(const Filter *ft); diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index 9cf03fcc..b0d48f88 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -1063,13 +1063,13 @@ class Resource upx_byte *name; upx_rnode *parent; }; - struct upx_rbranch : upx_rnode + struct upx_rbranch : public upx_rnode { unsigned nc; upx_rnode **children; res_dir data; }; - struct upx_rleaf : upx_rnode + struct upx_rleaf : public upx_rnode { upx_rleaf *next; unsigned newoffset; diff --git a/src/tailor.h b/src/tailor.h index a9ca33a4..9992321a 100644 --- a/src/tailor.h +++ b/src/tailor.h @@ -156,6 +156,12 @@ # define HAVE_MODE_T 1 # define HAVE_CHMOD 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) # define __UPX_CDECL __cdecl # define SIGTYPEENTRY __cdecl diff --git a/src/util.cpp b/src/util.cpp index 9e03ae30..4e1395e2 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -704,7 +704,7 @@ char *textdomain(const char *) #endif /* __linux__ && __GLIBC__ */ -}; // extern "C" +} // extern "C" /*