diff --git a/src/bele.h b/src/bele.h index db613fcc..f55ea8f8 100644 --- a/src/bele.h +++ b/src/bele.h @@ -282,12 +282,12 @@ inline unsigned acc_swap32p(const acc_uint32e_t *p) inline void acc_swab16s(acc_uint16e_t *p) { - *p = acc_swab16(*p); + *p = (acc_uint16e_t) acc_swab16(*p); } inline void acc_swab32s(acc_uint32e_t *p) { - *p = acc_swab32(*p); + *p = (acc_uint32e_t) acc_swab32(*p); } @@ -313,8 +313,7 @@ inline void acc_ua_swab32s(void *p) // to have gcc bug 17519 fixed - see http://gcc.gnu.org/PR17519 ] **************************************************************************/ -struct BE16 -{ +__packed_struct(BE16) unsigned char d[2]; //inline BE16() { } @@ -332,12 +331,10 @@ struct BE16 BE16& operator >>= (unsigned v) { set_be16(d, get_be16(d) >> v); return *this; } operator unsigned () const { return get_be16(d); } -} -__attribute_packed; +__packed_struct_end() -struct BE32 -{ +__packed_struct(BE32) unsigned char d[4]; //inline BE32() { } @@ -355,12 +352,10 @@ struct BE32 BE32& operator >>= (unsigned v) { set_be32(d, get_be32(d) >> v); return *this; } operator unsigned () const { return get_be32(d); } -} -__attribute_packed; +__packed_struct_end() -struct BE64 -{ +__packed_struct(BE64) unsigned char d[8]; //inline BE64() { } @@ -378,12 +373,10 @@ struct BE64 BE64& operator >>= (unsigned v) { set_be64(d, get_be64(d) >> v); return *this; } operator acc_uint64l_t () const { return get_be64(d); } -} -__attribute_packed; +__packed_struct_end() -struct LE16 -{ +__packed_struct(LE16) unsigned char d[2]; //inline LE16() { } @@ -401,12 +394,10 @@ struct LE16 LE16& operator >>= (unsigned v) { set_le16(d, get_le16(d) >> v); return *this; } operator unsigned () const { return get_le16(d); } -} -__attribute_packed; +__packed_struct_end() -struct LE32 -{ +__packed_struct(LE32) unsigned char d[4]; //inline LE32() { } @@ -424,12 +415,10 @@ struct LE32 LE32& operator >>= (unsigned v) { set_le32(d, get_le32(d) >> v); return *this; } operator unsigned () const { return get_le32(d); } -} -__attribute_packed; +__packed_struct_end() -struct LE64 -{ +__packed_struct(LE64) unsigned char d[8]; //inline LE64() { } @@ -447,8 +436,7 @@ struct LE64 LE64& operator >>= (unsigned v) { set_le64(d, get_le64(d) >> v); return *this; } operator acc_uint64l_t () const { return get_le64(d); } -} -__attribute_packed; +__packed_struct_end() /************************************************************************* @@ -623,16 +611,10 @@ namespace N_BELE_RTP { } namespace N_BELE_CTP { - -template -inline const N_BELE_RTP::AbstractPolicy* getRTP(); -template <> -inline const N_BELE_RTP::AbstractPolicy* getRTP() - { return &N_BELE_RTP::be_policy; } -template <> -inline const N_BELE_RTP::AbstractPolicy* getRTP() - { return &N_BELE_RTP::le_policy; } - +inline const N_BELE_RTP::AbstractPolicy* getRTP(const BEPolicy*) + { return &N_BELE_RTP::be_policy; } +inline const N_BELE_RTP::AbstractPolicy* getRTP(const LEPolicy*) + { return &N_BELE_RTP::le_policy; } } diff --git a/src/compress_ucl.cpp b/src/compress_ucl.cpp index 813f2170..a692052a 100644 --- a/src/compress_ucl.cpp +++ b/src/compress_ucl.cpp @@ -85,7 +85,7 @@ static int convert_errno_from_ucl(int r) extern "C" { -static void wrap_nprogress_ucl(ucl_uint a, ucl_uint b, int state, ucl_voidp user) +static void __UCL_CDECL wrap_nprogress_ucl(ucl_uint a, ucl_uint b, int state, ucl_voidp user) { if (state != -1 && state != 3) return; upx_callback_p cb = (upx_callback_p) user; diff --git a/src/conf.h b/src/conf.h index cb9f8581..c8a9900b 100644 --- a/src/conf.h +++ b/src/conf.h @@ -111,6 +111,9 @@ # error "need Watcom C++ 11.0c or newer" # endif # if defined(__cplusplus) +# pragma warning 367 9 // w3: conditional expression in if statement is always true +# pragma warning 368 9 // w3: conditional expression in if statement is always false +# pragma warning 389 9 // w3: integral value may be truncated # pragma warning 656 9 // w5: define this function inside its class definition (may improve code quality) # endif #endif @@ -160,6 +163,9 @@ #if 0 && !defined(WITH_LZMA) # define WITH_LZMA 1 #endif +#if 1 && (ACC_CC_WATCOMC) +# undef WITH_LZMA +#endif #if defined(UPX_OFFICIAL_BUILD) # if !defined(WITH_LZMA) || !defined(WITH_NRV) || !defined(WITH_UCL) # error @@ -302,16 +308,25 @@ #undef __attribute_packed -#if (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE) -# if (ACC_ARCH_I386) && (ACC_CC_INTELC && (__INTEL_COMPILER < 800)) -# elif (0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386)) -# else -# define __attribute_packed __attribute__((__packed__,__aligned__(1))) -# endif +#if (ACC_CC_INTELC && (__INTEL_COMPILER < 800)) +#elif (0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386)) +#elif (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE) +# define __attribute_packed __attribute__((__packed__,__aligned__(1))) +# define __packed_struct(s) struct s { +# define __packed_struct_end() } __attribute_packed; +#elif (ACC_CC_WATCOMC) +# define __attribute_packed +# define __packed_struct(s) _Packed struct s { +# define __packed_struct_end() }; #endif + #if !defined(__attribute_packed) # define __attribute_packed #endif +#if !defined(__packed_struct) +# define __packed_struct(s) struct s { +# define __packed_struct_end() }; +#endif /************************************************************************* @@ -323,8 +338,9 @@ #define __COMPILE_TIME_ASSERT_ALIGNOF_SIZEOF(a,b) { \ typedef a acc_tmp_a_t; typedef b acc_tmp_b_t; \ - struct acc_tmp_t { acc_tmp_b_t x; acc_tmp_a_t y; acc_tmp_b_t z; } __attribute_packed; \ + __packed_struct(acc_tmp_t) acc_tmp_b_t x; acc_tmp_a_t y; acc_tmp_b_t z; __packed_struct_end() \ COMPILE_TIME_ASSERT(sizeof(struct acc_tmp_t) == 2*sizeof(b)+sizeof(a)) \ + 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)) \ } #if defined(__acc_alignof) # define __COMPILE_TIME_ASSERT_ALIGNOF(a,b) \ diff --git a/src/filter/ppcbxx.h b/src/filter/ppcbxx.h index eb03c180..2be19e4b 100644 --- a/src/filter/ppcbxx.h +++ b/src/filter/ppcbxx.h @@ -47,7 +47,7 @@ static int F(Filter *f) // scan const upx_byte *b = f->buf; #endif - const unsigned size = umin(f->buf_len, -(~0u<<(32 - (6+ W_CTO)))); + const unsigned size = umin(f->buf_len, 0u - (~0u<<(32 - (6+ W_CTO)))); const unsigned size4 = size -4; unsigned ic; @@ -72,9 +72,11 @@ static int F(Filter *f) } if (getcto(f, buf) < 0) { - if (0!=W_CTO) // FIXME: what is this ??? - return -1; +#if (W_CTO != 0) + return -1; +#else f->cto = 0; +#endif } } const unsigned char cto8 = f->cto; @@ -95,8 +97,9 @@ static int F(Filter *f) lastcall = ic; } else { - assert(0==W_CTO // FIXME: what is this ??? - || (~(~0u<>(24+2 - W_CTO))) != cto8); // this should not happen +#if (W_CTO != 0) + assert((~(~0u<>(24+2 - W_CTO))) != cto8); // this should not happen +#endif lastnoncall = ic; noncalls++; } @@ -122,7 +125,7 @@ static int F(Filter *f) static int U(Filter *f) { upx_byte *b = f->buf; - const unsigned size4 = umin(f->buf_len - 4, -(~0u<<(32 - (6+ W_CTO)))); + const unsigned size4 = umin(f->buf_len - 4, 0u - (~0u<<(32 - (6+ W_CTO)))); const unsigned addvalue = f->addvalue; unsigned ic; diff --git a/src/main.cpp b/src/main.cpp index 24cd5fc1..cca33630 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1257,8 +1257,8 @@ template struct TestBELE { static bool test(void) { COMPILE_TIME_ASSERT_ALIGNED1(T) - struct test1_t { char a; T b; } __attribute_packed; - struct test2_t { char a; T b[3]; } __attribute_packed; + __packed_struct(test1_t) char a; T b; __packed_struct_end() + __packed_struct(test2_t) char a; T b[3]; __packed_struct_end() test1_t t1[7]; UNUSED(t1); test2_t t2[7]; UNUSED(t2); COMPILE_TIME_ASSERT(sizeof(test1_t) == 1 + sizeof(T)) COMPILE_TIME_ASSERT_ALIGNED1(test1_t) @@ -1270,7 +1270,11 @@ static bool test(void) COMPILE_TIME_ASSERT(__acc_alignof(t1) == 1) COMPILE_TIME_ASSERT(__acc_alignof(t2) == 1) #endif -#if 1 && !defined(xUPX_OFFICIAL_BUILD) +#if 1 && (ACC_CC_WATCOMC) + test1_t t11; COMPILE_TIME_ASSERT(sizeof(t11.a) <= sizeof(t11.b)) + test2_t t22; COMPILE_TIME_ASSERT(sizeof(t22.a) <= sizeof(t22.b)) +#endif +#if 1 && !defined(UPX_OFFICIAL_BUILD) T allbits; allbits = 0; allbits -= 1; //++allbits; allbits++; --allbits; allbits--; T v1; v1 = 1; v1 *= 2; v1 -= 1; diff --git a/src/p_elf.h b/src/p_elf.h index 656dd91d..feb9c554 100644 --- a/src/p_elf.h +++ b/src/p_elf.h @@ -52,8 +52,7 @@ struct ElfITypes // The ELF file header. This appears at the start of every ELF file. template -struct Ehdr -{ +__packed_struct(Ehdr) typedef typename TElfITypes::Half Half; typedef typename TElfITypes::Word Word; typedef typename TElfITypes::Addr Addr; @@ -76,13 +75,11 @@ struct Ehdr # define WANT_EHDR_ENUM 1 # include "p_elf_enum.h" -} -__attribute_packed; +__packed_struct_end() template -struct Dyn -{ +__packed_struct(Dyn) typedef typename TElfITypes::Xword Xword; typedef typename TElfITypes::Addr Addr; @@ -91,13 +88,11 @@ struct Dyn # define WANT_DYN_ENUM 1 # include "p_elf_enum.h" -} -__attribute_packed; +__packed_struct_end() template -struct External_Note -{ +__packed_struct(External_Note) typedef typename TElfITypes::Word Word; Word xn_namesz; // includes terminating '\0' @@ -105,8 +100,7 @@ struct External_Note Word xn_type; //char xn_name[N]; // terminate with '\0' //char xn_data[M]; // aligned to 0 mod 4 -} -__attribute_packed; +__packed_struct_end() } // namespace N_Elf @@ -119,8 +113,7 @@ __attribute_packed; namespace N_Elf32 { template -struct Phdr -{ +__packed_struct(Phdr) typedef typename TElfITypes::Word Word; typedef typename TElfITypes::Addr Addr; typedef typename TElfITypes::Off Off; @@ -136,13 +129,11 @@ struct Phdr # define WANT_PHDR_ENUM 1 # include "p_elf_enum.h" -} -__attribute_packed; +__packed_struct_end() template -struct Shdr -{ +__packed_struct(Shdr) typedef typename TElfITypes::Word Word; typedef typename TElfITypes::Addr Addr; typedef typename TElfITypes::Off Off; @@ -160,13 +151,11 @@ struct Shdr # define WANT_SHDR_ENUM 1 # include "p_elf_enum.h" -} -__attribute_packed; +__packed_struct_end() template -struct Sym -{ +__packed_struct(Sym) typedef typename TElfITypes::Word Word; typedef typename TElfITypes::Addr Addr; typedef typename TElfITypes::Section Section; @@ -184,8 +173,7 @@ struct Sym static unsigned int get_st_bind(unsigned x) { return 0xf & (x>>4); } static unsigned int get_st_type(unsigned x) { return 0xf & x ; } static unsigned char make_st_info(unsigned bind, unsigned type) { return (bind<<4) + (0xf & type); } -} -__attribute_packed; +__packed_struct_end() } // namespace N_Elf32 @@ -198,8 +186,7 @@ __attribute_packed; namespace N_Elf64 { template -struct Phdr -{ +__packed_struct(Phdr) typedef typename TElfITypes::Word Word; typedef typename TElfITypes::Xword Xword; typedef typename TElfITypes::Addr Addr; @@ -216,13 +203,11 @@ struct Phdr # define WANT_PHDR_ENUM 1 # include "p_elf_enum.h" -} -__attribute_packed; +__packed_struct_end() template -struct Shdr -{ +__packed_struct(Shdr) typedef typename TElfITypes::Word Word; typedef typename TElfITypes::Xword Xword; typedef typename TElfITypes::Addr Addr; @@ -241,13 +226,11 @@ struct Shdr # define WANT_SHDR_ENUM 1 # include "p_elf_enum.h" -} -__attribute_packed; +__packed_struct_end() template -struct Sym -{ +__packed_struct(Sym) typedef typename TElfITypes::Word Word; typedef typename TElfITypes::Xword Xword; typedef typename TElfITypes::Addr Addr; @@ -266,8 +249,7 @@ struct Sym static unsigned int get_st_bind(unsigned x) { return 0xf & (x>>4); } static unsigned int get_st_type(unsigned x) { return 0xf & x ; } static unsigned char make_st_info(unsigned bind, unsigned type) { return (bind<<4) + (0xf & type); } -} -__attribute_packed; +__packed_struct_end() } // namespace N_Elf64 diff --git a/src/p_exe.cpp b/src/p_exe.cpp index e9add672..873d0171 100644 --- a/src/p_exe.cpp +++ b/src/p_exe.cpp @@ -51,7 +51,8 @@ PackExe::PackExe(InputFile *f) : super(f) { bele = &N_BELE_RTP::le_policy; - COMPILE_TIME_ASSERT(sizeof(exe_header_t) == 32); + COMPILE_TIME_ASSERT(sizeof(exe_header_t) == 32) + COMPILE_TIME_ASSERT_ALIGNED1(exe_header_t) ih_exesize = ih_imagesize = ih_overlay = 0; stack_for_lzma = 0; use_clear_dirty_stack = false; diff --git a/src/p_exe.h b/src/p_exe.h index d93a9e5a..93e034be 100644 --- a/src/p_exe.h +++ b/src/p_exe.h @@ -74,8 +74,7 @@ protected: virtual Linker* newLinker() const; void addLoaderEpilogue(int flag); - struct exe_header_t - { + __packed_struct(exe_header_t) LE16 ident; LE16 m512; LE16 p512; @@ -91,8 +90,7 @@ protected: LE16 relocoffs; char __[2]; // overlnum LE32 firstreloc; - } - __attribute_packed; + __packed_struct_end() exe_header_t ih, oh; diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 28e50c77..c5739eac 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -846,14 +846,14 @@ bool PackLinuxElf32::canPack() { union { unsigned char buf[sizeof(Elf32_Ehdr) + 14*sizeof(Elf32_Phdr)]; - struct { Elf32_Ehdr ehdr; Elf32_Phdr phdr; } e; + //struct { U_Elf32_Ehdr ehdr; U_Elf32_Phdr phdr; } e; } u; COMPILE_TIME_ASSERT(sizeof(u.buf) <= 512); fi->seek(0, SEEK_SET); fi->readx(u.buf, sizeof(u.buf)); fi->seek(0, SEEK_SET); - Elf32_Ehdr const *const ehdr = &u.e.ehdr; + Elf32_Ehdr const *const ehdr = (Elf32_Ehdr *) u.buf; // now check the ELF header if (checkEhdr(ehdr) != 0) @@ -897,7 +897,7 @@ bool PackLinuxElf32::canPack() && 1==get_te32(¬e.type) && 0==note.end && (1+ strlen(osabi_note))==get_te32(¬e.namesz) - && 0==strcmp(osabi_note, (char const *)¬e.text) + && 0==strcmp(osabi_note, (char const *)note.text) ) { osabi0 = ei_osabi; // Specified by PT_NOTE. } @@ -937,7 +937,7 @@ bool PackLinuxElf32::canPack() file_image = new char[file_size]; fi->seek(0, SEEK_SET); fi->readx(file_image, file_size); - ehdri= *ehdr; + memcpy(&ehdri, ehdr, sizeof(Elf32_Ehdr)); phdri= (Elf32_Phdr *)(e_phoff + file_image); // do not free() !! shdri= (Elf32_Shdr *)(e_shoff + file_image); // do not free() !! @@ -1007,13 +1007,13 @@ PackLinuxElf64amd::canPack() { union { unsigned char buf[sizeof(Elf64_Ehdr) + 14*sizeof(Elf64_Phdr)]; - struct { Elf64_Ehdr ehdr; Elf64_Phdr phdr; } e; + //struct { Elf64_Ehdr ehdr; Elf64_Phdr phdr; } e; } u; COMPILE_TIME_ASSERT(sizeof(u) <= 1024); fi->readx(u.buf, sizeof(u.buf)); fi->seek(0, SEEK_SET); - Elf64_Ehdr const *const ehdr = &u.e.ehdr; + Elf64_Ehdr const *const ehdr = (Elf64_Ehdr *) u.buf; // now check the ELF header if (checkEhdr(ehdr) != 0) @@ -1895,11 +1895,11 @@ void PackLinuxElf32::unpack(OutputFile *fo) { #define MAX_ELF_HDR 512 union { - char buf[MAX_ELF_HDR]; - struct { Elf32_Ehdr ehdr; Elf32_Phdr phdr; } e; + unsigned char buf[MAX_ELF_HDR]; + //struct { Elf32_Ehdr ehdr; Elf32_Phdr phdr; } e; } u; - Elf32_Ehdr *const ehdr = &u.e.ehdr; - Elf32_Phdr const *phdr = &u.e.phdr; + Elf32_Ehdr *const ehdr = (Elf32_Ehdr *) u.buf; + Elf32_Phdr const *phdr = (Elf32_Phdr *) (u.buf + sizeof(*ehdr)); unsigned szb_info = sizeof(b_info); { @@ -1958,7 +1958,7 @@ void PackLinuxElf32::unpack(OutputFile *fo) } } - phdr = &u.e.phdr; + phdr = (Elf32_Phdr *) (u.buf + sizeof(*ehdr)); for (unsigned j = 0; j < phnum; ++j) { unsigned const size = find_LOAD_gap(phdr, j, phnum); if (size) { @@ -2003,11 +2003,11 @@ void PackLinuxElf64::unpack(OutputFile *fo) { #define MAX_ELF_HDR 1024 union { - char buf[MAX_ELF_HDR]; - struct { Elf64_Ehdr ehdr; Elf64_Phdr phdr; } e; + unsigned char buf[MAX_ELF_HDR]; + //struct { Elf64_Ehdr ehdr; Elf64_Phdr phdr; } e; } u; - Elf64_Ehdr *const ehdr = &u.e.ehdr; - Elf64_Phdr const *phdr = &u.e.phdr; + Elf64_Ehdr *const ehdr = (Elf64_Ehdr *) u.buf; + Elf64_Phdr const *phdr = (Elf64_Phdr *) (u.buf + sizeof(*ehdr)); unsigned szb_info = sizeof(b_info); { @@ -2066,7 +2066,7 @@ void PackLinuxElf64::unpack(OutputFile *fo) } } - phdr = &u.e.phdr; + phdr = (Elf64_Phdr *) (u.buf + sizeof(*ehdr)); for (unsigned j = 0; j < phnum; ++j) { unsigned const size = find_LOAD_gap(phdr, j, phnum); if (size) { @@ -2367,11 +2367,11 @@ void PackLinuxElf32x86::unpack(OutputFile *fo) { #define MAX_ELF_HDR 512 union { - char buf[MAX_ELF_HDR]; - struct { Elf32_Ehdr ehdr; Elf32_Phdr phdr; } e; + unsigned char buf[MAX_ELF_HDR]; + //struct { Elf32_Ehdr ehdr; Elf32_Phdr phdr; } e; } u; - Elf32_Ehdr *const ehdr = &u.e.ehdr; - Elf32_Phdr const *phdr = &u.e.phdr; + Elf32_Ehdr *const ehdr = (Elf32_Ehdr *) u.buf; + Elf32_Phdr const *phdr = (Elf32_Phdr *) (u.buf + sizeof(*ehdr)); unsigned szb_info = sizeof(b_info); { @@ -2430,7 +2430,7 @@ void PackLinuxElf32x86::unpack(OutputFile *fo) } } - phdr = &u.e.phdr; + phdr = (Elf32_Phdr *) (u.buf + sizeof(*ehdr)); for (unsigned j = 0; j < phnum; ++j) { unsigned const size = find_LOAD_gap(phdr, j, phnum); if (size) { diff --git a/src/p_lx_exc.cpp b/src/p_lx_exc.cpp index 17181816..a19c98c0 100644 --- a/src/p_lx_exc.cpp +++ b/src/p_lx_exc.cpp @@ -529,13 +529,13 @@ bool PackLinuxI386::canPack() unsigned const e_phnum = get_te16(&ehdr.e_phnum); if (e_phnum<=(512/sizeof(Elf32_Phdr))) { union { - char buf2[512]; - Elf32_Phdr phdr; + unsigned char buf2[512]; + //Elf32_Phdr phdr; } u; fi->seek(get_te32(&ehdr.e_phoff), SEEK_SET); fi->readx(u.buf2, sizeof(u.buf2)); fi->seek(0, SEEK_SET); - Elf32_Phdr const *phdr = &u.phdr; + Elf32_Phdr const *phdr = (Elf32_Phdr *) u.buf2; for (unsigned j=0; j < e_phnum; ++phdr, ++j) { if (phdr->PT_NOTE == get_te32(&phdr->p_type)) { unsigned const offset = get_te32(&phdr->p_offset); @@ -546,11 +546,11 @@ bool PackLinuxI386::canPack() if (4==get_te32(¬e.descsz) && 1==get_te32(¬e.type) && 0==note.end ) { - if (0==strcmp("NetBSD", (char const *)¬e.text)) { + if (0==strcmp("NetBSD", (char const *)note.text)) { ei_osabi = Elf32_Ehdr::ELFOSABI_NETBSD; break; } - if (0==strcmp("OpenBSD", (char const *)¬e.text)) { + if (0==strcmp("OpenBSD", (char const *)note.text)) { ei_osabi = Elf32_Ehdr::ELFOSABI_OPENBSD; break; } diff --git a/src/p_lx_interp.cpp b/src/p_lx_interp.cpp index 313df714..8a235f0c 100644 --- a/src/p_lx_interp.cpp +++ b/src/p_lx_interp.cpp @@ -198,11 +198,11 @@ void PackLinuxElf32x86interp::unpack(OutputFile *fo) { #define MAX_INTERP_HDR 512 union { - char buf[MAX_INTERP_HDR]; - struct { Elf32_Ehdr ehdr; Elf32_Phdr phdr; } e; + unsigned char buf[MAX_INTERP_HDR]; + //struct { Elf32_Ehdr ehdr; Elf32_Phdr phdr; } e; } u; - Elf32_Ehdr *const ehdr = &u.e.ehdr; - Elf32_Phdr const *phdr = &u.e.phdr; + Elf32_Ehdr *const ehdr = (Elf32_Ehdr *) u.buf; + Elf32_Phdr const *phdr = (Elf32_Phdr *) (u.buf + sizeof(*ehdr)); unsigned szb_info = sizeof(b_info); { diff --git a/src/p_mach.cpp b/src/p_mach.cpp index 44ba11f1..6b033124 100644 --- a/src/p_mach.cpp +++ b/src/p_mach.cpp @@ -57,7 +57,7 @@ PackMachBase::PackMachBase(InputFile *f, unsigned cputype, unsigned flavor, n_segment(0), rawmseg(NULL), msegcmd(NULL) { MachClass::compileTimeAssertions(); - bele = N_BELE_CTP::getRTP(); + bele = N_BELE_CTP::getRTP((const BeLePolicy*) NULL); } template @@ -574,7 +574,7 @@ void PackMachBase::pack1(OutputFile *const fo, Filter &/*ft*/) // generate e segcmdo.cmd = Mach_segment_command::LC_SEGMENT; segcmdo.cmdsize = sizeof(segcmdo); - strncpy((char *)&segcmdo.segname, "__TEXT", sizeof(segcmdo.segname)); + strncpy((char *)segcmdo.segname, "__TEXT", sizeof(segcmdo.segname)); segcmdo.vmaddr = PAGE_MASK & (~PAGE_MASK + msegcmd[n_segment -1].vmsize + msegcmd[n_segment -1].vmaddr ); segcmdo.vmsize = 0; // adjust later @@ -683,10 +683,10 @@ bool PackMachBase::canPack() ) return false; - rawmseg = (Mach_segment_command *)new char[mhdri.sizeofcmds]; + rawmseg = (Mach_segment_command *)new char[(unsigned) mhdri.sizeofcmds]; fi->readx(rawmseg, mhdri.sizeofcmds); - msegcmd = new Mach_segment_command[mhdri.ncmds]; + msegcmd = new Mach_segment_command[(unsigned) mhdri.ncmds]; unsigned char *ptr = (unsigned char *)rawmseg; for (unsigned j= 0; j < mhdri.ncmds; ++j) { msegcmd[j] = *(Mach_segment_command *)ptr; diff --git a/src/p_mach.h b/src/p_mach.h index 842702f0..1e445104 100644 --- a/src/p_mach.h +++ b/src/p_mach.h @@ -30,24 +30,22 @@ #define __UPX_P_MACHO_H -struct Mach_fat_header { +__packed_struct(Mach_fat_header) BE32 magic; enum { // note conflict with java bytecode PackLinuxI386 FAT_MAGIC = 0xcafebabe, FAT_MAGIC_SWAB = 0xbebafeca }; BE32 nfat_arch; // Number of Mach_fat_arch which follow. -} -__attribute_packed; +__packed_struct_end() -struct Mach_fat_arch { +__packed_struct(Mach_fat_arch) BE32 cputype; BE32 cpusubtype; BE32 offset; BE32 size; BE32 align; /* shift count; log base 2 */ -} -__attribute_packed; +__packed_struct_end() /************************************************************************* @@ -68,8 +66,7 @@ struct MachITypes }; template -struct Mach_header -{ +__packed_struct(Mach_header) typedef typename TMachITypes::Word Word; Word magic; @@ -81,12 +78,11 @@ struct Mach_header Word flags; #define WANT_MACH_HEADER_ENUM 1 #include "p_mach_enum.h" -} -__attribute_packed; +__packed_struct_end() template -struct Mach_header64 -{ // only difference is padding to 0 mod 8 +__packed_struct(Mach_header64) + // only difference is padding to 0 mod 8 typedef typename TMachITypes::Word Word; Word magic; @@ -99,12 +95,10 @@ struct Mach_header64 Word reserved; // pad to 0 mod 8 #define WANT_MACH_HEADER_ENUM 1 #include "p_mach_enum.h" -} -__attribute_packed; +__packed_struct_end() template -struct Mach_segment_command -{ +__packed_struct(Mach_segment_command) typedef typename TMachITypes::Word Word; typedef typename TMachITypes::Addr Addr; typedef typename TMachITypes::Off Off; @@ -122,12 +116,10 @@ struct Mach_segment_command Word flags; #define WANT_MACH_SEGMENT_ENUM 1 #include "p_mach_enum.h" -} -__attribute_packed; +__packed_struct_end() template -struct Mach_section_command -{ +__packed_struct(Mach_section_command) typedef typename TMachITypes::Word Word; typedef typename TMachITypes::Addr Addr; typedef typename TMachITypes::Off Off; @@ -145,12 +137,10 @@ struct Mach_section_command Word reserved2; #define WANT_MACH_SECTION_ENUM 1 #include "p_mach_enum.h" -} -__attribute_packed; +__packed_struct_end() template -struct Mach_ppc_thread_state -{ +__packed_struct(Mach_ppc_thread_state) typedef typename TMachITypes::Addr Addr; Addr srr0; /* Instruction address register (PC; entry addr) */ @@ -167,12 +157,10 @@ struct Mach_ppc_thread_state Addr mq; /* MQ register (601 only) */ Addr vrsave; /* Vector Save Register */ -} -__attribute_packed; +__packed_struct_end() template -struct Mach_i386_thread_state -{ +__packed_struct(Mach_i386_thread_state) typedef typename TMachITypes::Word Word; Word eax, ebx, ecx, edx; @@ -181,12 +169,10 @@ struct Mach_i386_thread_state Word eflags; Word eip, cs; Word ds, es, fs, gs; -} -__attribute_packed; +__packed_struct_end() template -struct Mach_i386_new_thread_state -{ +__packed_struct(Mach_i386_new_thread_state) typedef typename TMachITypes::Word Word; Word gs, fs, es, ds; @@ -194,12 +180,10 @@ struct Mach_i386_new_thread_state Word ebx, edx, ecx, eax; Word eip, cs, efl; Word uesp, ss; -} -__attribute_packed; +__packed_struct_end() template -struct Mach_ARM_thread_state -{ +__packed_struct(Mach_ARM_thread_state) typedef typename TMachITypes::Word Word; Word r[13]; // r0-r12 @@ -207,8 +191,7 @@ struct Mach_ARM_thread_state Word lr; // r14 Word pc; // r15 Word cpsr; -} -__attribute_packed; +__packed_struct_end() } // namespace N_Mach @@ -219,8 +202,7 @@ namespace N_Mach32 { namespace N_Mach64 { template -struct Mach_ppc_thread_state64 -{ +__packed_struct(Mach_ppc_thread_state64) typedef typename TMachITypes::Word Word; typedef typename TMachITypes::Xword Xword; @@ -237,8 +219,7 @@ struct Mach_ppc_thread_state64 Xword ctr; /* Count register */ Word vrsave; /* Vector Save Register */ -} -__attribute_packed; +__packed_struct_end() } // namespace N_Mach64 @@ -395,30 +376,28 @@ protected: Mach_header mhdro; Mach_segment_command segcmdo; - struct b_info { // 12-byte header before each compressed block + __packed_struct(b_info) // 12-byte header before each compressed block TE32 sz_unc; // uncompressed_size TE32 sz_cpr; // compressed_size - unsigned char b_method; // compression algorithm - unsigned char b_ftid; // filter id - unsigned char b_cto8; // filter parameter + unsigned char b_method; // compression algorithm + unsigned char b_ftid; // filter id + unsigned char b_cto8; // filter parameter unsigned char b_unused; - } - __attribute_packed; - struct l_info { // 12-byte trailer in header for loader + __packed_struct_end() + + __packed_struct(l_info) // 12-byte trailer in header for loader TE32 l_checksum; LE32 l_magic; TE16 l_lsize; unsigned char l_version; unsigned char l_format; - } - __attribute_packed; + __packed_struct_end() - struct p_info { // 12-byte packed program header + __packed_struct(p_info) // 12-byte packed program header TE32 p_progid; TE32 p_filesize; TE32 p_blocksize; - } - __attribute_packed; + __packed_struct_end() struct l_info linfo; @@ -456,8 +435,7 @@ protected: virtual Linker* newLinker() const; virtual void buildLoader(const Filter *ft); - struct Mach_thread_command - { + __packed_struct(Mach_thread_command) BE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */ BE32 cmdsize; /* total size of this command */ BE32 flavor; @@ -465,8 +443,8 @@ protected: Mach_ppc_thread_state state; #define WANT_MACH_THREAD_ENUM #include "p_mach_enum.h" - } - __attribute_packed; + __packed_struct_end() + Mach_thread_command threado; }; @@ -492,8 +470,7 @@ protected: virtual void buildLoader(const Filter *ft); virtual void addStubEntrySections(Filter const *); - struct Mach_thread_command - { + __packed_struct(Mach_thread_command) LE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */ LE32 cmdsize; /* total size of this command */ LE32 flavor; @@ -501,8 +478,8 @@ protected: Mach_i386_thread_state state; #define WANT_MACH_THREAD_ENUM #include "p_mach_enum.h" - } - __attribute_packed; + __packed_struct_end() + Mach_thread_command threado; }; @@ -529,8 +506,7 @@ protected: virtual void buildLoader(const Filter *ft); virtual void addStubEntrySections(Filter const *); - struct Mach_thread_command - { + __packed_struct(Mach_thread_command) LE32 cmd; /* LC_THREAD or LC_UNIXTHREAD */ LE32 cmdsize; /* total size of this command */ LE32 flavor; @@ -538,8 +514,8 @@ protected: Mach_ARM_thread_state state; #define WANT_MACH_THREAD_ENUM #include "p_mach_enum.h" - } - __attribute_packed; + __packed_struct_end() + Mach_thread_command threado; }; @@ -577,11 +553,11 @@ public: #endif enum { N_FAT_ARCH = 5 }; protected: - struct Fat_head { + __packed_struct(Fat_head) struct Mach_fat_header fat; struct Mach_fat_arch arch[N_FAT_ARCH]; - } - __attribute_packed; + __packed_struct_end() + Fat_head fat_head; // UI handler diff --git a/src/p_mach_enum.h b/src/p_mach_enum.h index 54ee8fc9..217d550f 100644 --- a/src/p_mach_enum.h +++ b/src/p_mach_enum.h @@ -2,7 +2,7 @@ This file is part of the UPX executable compressor. - Copyright (C) 2007 John F. Reiser + Copyright (C) 2007-2007 John F. Reiser All Rights Reserved. UPX and the UCL library are free software; you can redistribute them diff --git a/src/p_ps1.cpp b/src/p_ps1.cpp index e35fc3f2..80093281 100644 --- a/src/p_ps1.cpp +++ b/src/p_ps1.cpp @@ -127,8 +127,8 @@ int PackPs1::readFileHeader() { fi->seek(0, SEEK_SET); fi->readx(&ih, sizeof(ih)); - if (memcmp(&ih.id, "PS-X EXE", 8) != 0 && - memcmp(&ih.id, "EXE X-SP", 8) != 0) + if (memcmp(&ih.id[0], "PS-X EXE", 8) != 0 && + memcmp(&ih.id[0], "EXE X-SP", 8) != 0) return 0; if (ih.text != 0 || ih.data != 0) return 0; diff --git a/src/p_vmlinx.cpp b/src/p_vmlinx.cpp index c6ac185c..758181c6 100644 --- a/src/p_vmlinx.cpp +++ b/src/p_vmlinx.cpp @@ -64,7 +64,7 @@ PackVmlinuxBase::PackVmlinuxBase(InputFile *f, n_ptload(0), phdri(NULL), shdri(NULL), shstrtab(NULL) { ElfClass::compileTimeAssertions(); - bele = N_BELE_CTP::getRTP(); + bele = N_BELE_CTP::getRTP((const BeLePolicy*) NULL); } template @@ -628,7 +628,7 @@ void prep_kernel(unsigned long a1, unsigned long a2) fo->seek(0, SEEK_SET); fo->write(&ehdro, sizeof(ehdro)); - fo->write(&shdro, sizeof(shdro)); + fo->write(&shdro[0], sizeof(shdro)); if (Ehdr::EM_PPC==my_e_machine) { fo->seek(sizeof(unsigned), SEEK_CUR); set_be32(&ppc32_extra, ppc32_extra - 2*sizeof(unsigned) + txt_c_len); diff --git a/src/p_vmlinz.cpp b/src/p_vmlinz.cpp index f79d8e47..3dbe8f98 100644 --- a/src/p_vmlinz.cpp +++ b/src/p_vmlinz.cpp @@ -744,7 +744,7 @@ int PackVmlinuzARMEL::readFileHeader() { unsigned int hdr[8]; - fi->readx(&hdr, sizeof(hdr)); + fi->readx(hdr, sizeof(hdr)); for (int j=0; j < 8; ++j) { if (0xe1a00000!=get_te32(&hdr[j])) { return 0; diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index 7d7e45b1..8d3c3da8 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -164,7 +164,7 @@ int PackW32Pe::readFileHeader() char buf[6]; fi->seek(0x200, SEEK_SET); fi->readx(buf, 6); - isrtm = memcmp(&buf, "32STUB" ,6) == 0; + isrtm = memcmp(buf, "32STUB" ,6) == 0; return super::readFileHeader(); } diff --git a/src/p_wcle.cpp b/src/p_wcle.cpp index 07cb7078..a5c8b2d7 100644 --- a/src/p_wcle.cpp +++ b/src/p_wcle.cpp @@ -485,7 +485,7 @@ void PackWcle::pack(OutputFile *fo) const unsigned text_vaddr = IOT(ih.init_cs_object-1,my_base_address); // attach some useful data at the end of preprocessed fixups - ifixups[sofixups++] = (unsigned char) ih.automatic_data_object; + ifixups[sofixups++] = (unsigned char) (ih.automatic_data_object & 0xff); unsigned ic = objects*sizeof(*iobject_table); memcpy(ifixups+sofixups,iobject_desc,ic); iobject_desc.dealloc(); diff --git a/src/packmast.cpp b/src/packmast.cpp index 8e717d9d..a01dfea0 100644 --- a/src/packmast.cpp +++ b/src/packmast.cpp @@ -287,21 +287,21 @@ Packer* PackMaster::visitAllPackers(visit_func_t func, InputFile *f, const optio Packer *PackMaster::getPacker(InputFile *f) { - Packer *p = visitAllPackers(try_pack, f, opt, f); - if (!p) + Packer *pp = visitAllPackers(try_pack, f, opt, f); + if (!pp) throwUnknownExecutableFormat(); - p->assertPacker(); - return p; + pp->assertPacker(); + return pp; } Packer *PackMaster::getUnpacker(InputFile *f) { - Packer *p = visitAllPackers(try_unpack, f, opt, f); - if (!p) + Packer *pp = visitAllPackers(try_unpack, f, opt, f); + if (!pp) throwNotPacked(); - p->assertPacker(); - return p; + pp->assertPacker(); + return pp; } diff --git a/src/pefile.cpp b/src/pefile.cpp index f815d48c..3e158837 100644 --- a/src/pefile.cpp +++ b/src/pefile.cpp @@ -106,7 +106,7 @@ PeFile::PeFile(InputFile *f) : super(f) COMPILE_TIME_ASSERT_ALIGNED1(pe_header_t) COMPILE_TIME_ASSERT_ALIGNED1(pe_header_t::ddirs_t) COMPILE_TIME_ASSERT_ALIGNED1(pe_section_t) - COMPILE_TIME_ASSERT(RT_LAST == TABLESIZE(opt->win32_pe.compress_rt)); + COMPILE_TIME_ASSERT(RT_LAST == TABLESIZE(opt->win32_pe.compress_rt)) isection = NULL; oimport = NULL; @@ -158,8 +158,7 @@ bool PeFile::testUnpackVersion(int version) const int PeFile::readFileHeader() { - struct exe_header_t - { + __packed_struct(exe_header_t) LE16 mz; LE16 m512; LE16 p512; @@ -167,9 +166,12 @@ int PeFile::readFileHeader() LE16 relocoffs; char __[34]; LE32 nexepos; - } - __attribute_packed; - COMPILE_TIME_ASSERT(sizeof(exe_header_t) == 64); + __packed_struct_end() + + COMPILE_TIME_ASSERT(sizeof(exe_header_t) == 64) + COMPILE_TIME_ASSERT_ALIGNED1(exe_header_t) + COMPILE_TIME_ASSERT(sizeof(((exe_header_t*)0)->_) == 18) + COMPILE_TIME_ASSERT(sizeof(((exe_header_t*)0)->__) == 34) exe_header_t h; int ic; @@ -286,12 +288,10 @@ void PeFile::Interval::dump() const // relocation handling **************************************************************************/ -struct PeFile::Reloc::reloc -{ +__packed_struct(PeFile::Reloc::reloc) LE32 pagestart; LE32 size; -} -__attribute_packed; +__packed_struct_end() void PeFile::Reloc::newRelocPos(void *p) { @@ -302,7 +302,8 @@ void PeFile::Reloc::newRelocPos(void *p) PeFile::Reloc::Reloc(upx_byte *s,unsigned si) : start(s), size(si), rel(NULL), rel1(NULL) { - COMPILE_TIME_ASSERT(sizeof(reloc) == 8); + COMPILE_TIME_ASSERT(sizeof(reloc) == 8) + COMPILE_TIME_ASSERT_ALIGNED1(reloc) memset(counts,0,sizeof(counts)); unsigned pos,type; while (next(pos,type)) @@ -460,18 +461,17 @@ void PeFile::processRelocs() // pass1 // import handling **************************************************************************/ -struct import_desc -{ +__packed_struct(import_desc) LE32 oft; // orig first thunk char _[8]; LE32 dllname; LE32 iat; // import address table -} -__attribute_packed; +__packed_struct_end() void PeFile::processImports(unsigned myimport, unsigned iat_off) // pass 2 { - COMPILE_TIME_ASSERT(sizeof(import_desc) == 20); + COMPILE_TIME_ASSERT(sizeof(import_desc) == 20) + COMPILE_TIME_ASSERT_ALIGNED1(import_desc) // adjust import data for (import_desc *im = (import_desc*) oimpdlls; im->dllname; im++) @@ -755,7 +755,8 @@ unsigned PeFile::processImports() // pass 1 PeFile::Export::Export(char *_base) : base(_base), iv(_base) { - COMPILE_TIME_ASSERT(sizeof(export_dir_t) == 40); + COMPILE_TIME_ASSERT(sizeof(export_dir_t) == 40) + COMPILE_TIME_ASSERT_ALIGNED1(export_dir_t) ename = functionptrs = ordinals = NULL; names = NULL; memset(&edir,0,sizeof(edir)); @@ -903,19 +904,18 @@ void PeFile::processExports(Export *xport,unsigned newoffs) // pass2 // the virtual memory manager only for pages which are not yet loaded. // of course it was impossible to debug this ;-) -struct tls -{ +__packed_struct(tls) LE32 datastart; // VA tls init data start LE32 dataend; // VA tls init data end LE32 tlsindex; // VA tls index LE32 callbacks; // VA tls callbacks char _[8]; // zero init, characteristics -} -__attribute_packed; +__packed_struct_end() void PeFile::processTls(Interval *iv) // pass 1 { - COMPILE_TIME_ASSERT(sizeof(tls) == 24); + COMPILE_TIME_ASSERT(sizeof(tls) == 24) + COMPILE_TIME_ASSERT_ALIGNED1(tls) if ((sotls = ALIGN_UP(IDSIZE(PEDIR_TLS),4)) == 0) return; @@ -997,15 +997,12 @@ void PeFile::processTls(Reloc *rel,const Interval *iv,unsigned newaddr) // pass // resource handling **************************************************************************/ -struct PeFile::Resource::res_dir_entry -{ +__packed_struct(PeFile::Resource::res_dir_entry) LE32 tnl; // Type | Name | Language id - depending on level LE32 child; -} -__attribute_packed; +__packed_struct_end() -struct PeFile::Resource::res_dir -{ +__packed_struct(PeFile::Resource::res_dir) char _[12]; // flags, timedate, version LE16 namedentr; LE16 identr; @@ -1014,16 +1011,13 @@ struct PeFile::Resource::res_dir res_dir_entry entries[1]; // it's usually safe to assume that every res_dir contains // at least one res_dir_entry - check() complains otherwise -} -__attribute_packed; +__packed_struct_end() -struct PeFile::Resource::res_data -{ +__packed_struct(PeFile::Resource::res_data) LE32 offset; LE32 size; char _[8]; // codepage, reserved -} -__attribute_packed; +__packed_struct_end() struct PeFile::Resource::upx_rnode { @@ -1032,14 +1026,14 @@ struct PeFile::Resource::upx_rnode upx_rnode *parent; }; -struct PeFile::Resource::upx_rbranch : public upx_rnode +struct PeFile::Resource::upx_rbranch : public PeFile::Resource::upx_rnode { unsigned nc; upx_rnode **children; res_dir data; }; -struct PeFile::Resource::upx_rleaf : public upx_rnode +struct PeFile::Resource::upx_rleaf : public PeFile::Resource::upx_rnode { upx_rleaf *next; unsigned newoffset; @@ -1534,14 +1528,17 @@ unsigned PeFile::stripDebug(unsigned overlaystart) if (IDADDR(PEDIR_DEBUG) == 0) return overlaystart; - struct debug_dir_t - { + __packed_struct(debug_dir_t) char _[16]; // flags, time/date, version, type LE32 size; char __[4]; // rva LE32 fpos; - } - __attribute_packed; + __packed_struct_end() + + COMPILE_TIME_ASSERT(sizeof(debug_dir_t) == 28) + COMPILE_TIME_ASSERT_ALIGNED1(debug_dir_t) + COMPILE_TIME_ASSERT(sizeof(((debug_dir_t*)0)->_) == 16) + COMPILE_TIME_ASSERT(sizeof(((debug_dir_t*)0)->__) == 4) const debug_dir_t *dd = (const debug_dir_t*) (ibuf + IDADDR(PEDIR_DEBUG)); for (unsigned ic = 0; ic < IDSIZE(PEDIR_DEBUG) / sizeof(debug_dir_t); ic++, dd++) diff --git a/src/stdcxx.h b/src/stdcxx.h index a93f777e..dcaa5d15 100644 --- a/src/stdcxx.h +++ b/src/stdcxx.h @@ -97,6 +97,7 @@ namespace std { class bad_alloc { }; } #elif (ACC_CC_SYMANTECC) #define std class bad_alloc { }; +#elif (ACC_CC_WATCOMC && (__WATCOMC__ >= 1280)) #elif (ACC_CC_WATCOMC) #define std class bad_alloc { }; diff --git a/src/stub/scripts/UNUSED/bin2w.sh b/src/stub/scripts/UNUSED/bin2w.sh index fd069827..0668f9b6 100755 --- a/src/stub/scripts/UNUSED/bin2w.sh +++ b/src/stub/scripts/UNUSED/bin2w.sh @@ -5,7 +5,7 @@ # # This file is part of the UPX executable compressor. # -# Copyright (C) 2008 John F. Reiser +# Copyright (C) 2008-2008 John F. Reiser # All Rights Reserved. # # UPX and the UCL library are free software; you can redistribute them diff --git a/src/stub/src/i386-bsd.syscall.S b/src/stub/src/i386-bsd.syscall.S index eff9feb9..c7e510ca 100644 --- a/src/stub/src/i386-bsd.syscall.S +++ b/src/stub/src/i386-bsd.syscall.S @@ -3,7 +3,7 @@ ; ; This file is part of the UPX executable compressor. ; -; Copyright (C) 2006 John F. Reiser +; Copyright (C) 2006-2006 John F. Reiser ; All Rights Reserved. ; ; UPX and the UCL library are free software; you can redistribute them diff --git a/src/stub/src/i386-linux.kernel.vmlinux-head.S b/src/stub/src/i386-linux.kernel.vmlinux-head.S index 3ed53a00..981ed272 100644 --- a/src/stub/src/i386-linux.kernel.vmlinux-head.S +++ b/src/stub/src/i386-linux.kernel.vmlinux-head.S @@ -3,7 +3,7 @@ ; ; This file is part of the UPX executable compressor. ; -; Copyright (C) 2006 John Reiser +; Copyright (C) 2006-2006 John Reiser ; All Rights Reserved. ; ; UPX and the UCL library are free software; you can redistribute them diff --git a/src/stub/src/powerpc-linux.kernel.vmlinux-head.S b/src/stub/src/powerpc-linux.kernel.vmlinux-head.S index 86851770..b07375f2 100644 --- a/src/stub/src/powerpc-linux.kernel.vmlinux-head.S +++ b/src/stub/src/powerpc-linux.kernel.vmlinux-head.S @@ -3,7 +3,7 @@ ; ; This file is part of the UPX executable compressor. ; -; Copyright (C) 2007 John Reiser +; Copyright (C) 2007-2007 John Reiser ; All Rights Reserved. ; ; UPX and the UCL library are free software; you can redistribute them diff --git a/src/util.cpp b/src/util.cpp index ed918c86..dc0e9075 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -36,10 +36,12 @@ # pragma warning(disable: 4201 4214 4514) #endif #define ACC_WANT_ACC_INCI_H 1 +#include "miniacc.h" #define ACC_WANT_ACCLIB_HSREAD 1 #define ACC_WANT_ACCLIB_MISC 1 #define ACC_WANT_ACCLIB_UA 1 #define ACC_WANT_ACCLIB_WILDARGV 1 +#undef HAVE_MKDIR #include "miniacc.h"