From 97153e8e094f04dc88cf55cca7c67b002529d952 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Sat, 20 Dec 2003 10:57:09 +0000 Subject: [PATCH] Compile fixes for PGI C++. committer: mfx 1071917829 +0000 --- src/Makefile.bld | 12 +++++++++++- src/acc/acc_cxx.h | 2 ++ src/conf.h | 8 +++++--- src/help.cpp | 6 ++++++ src/main.cpp | 13 +++++++------ src/msg.cpp | 1 + src/options.h | 2 +- src/p_lx_elf.cpp | 4 ++-- src/p_lx_exc.cpp | 2 +- src/p_lx_sep.cpp | 6 +++--- src/p_unix.cpp | 5 ++--- src/packmast.cpp | 2 +- src/ui.cpp | 2 +- src/ui.h | 2 +- 14 files changed, 44 insertions(+), 23 deletions(-) diff --git a/src/Makefile.bld b/src/Makefile.bld index 564bbcc3..c3da951f 100644 --- a/src/Makefile.bld +++ b/src/Makefile.bld @@ -210,12 +210,22 @@ endif ### -### linux/i386 - Portland Group PGI C++ 5.1 +### linux/i386 - Portland Group PGI C++ 5.x ### ifeq ($(target),linux-pgi) +##DEPMODE := XXX_linux ## FIXME CC = pgcc CXX = pgCC +CCARCH += -tp=p6 +CFLAGS_OUTPUT = -o $@ +LINK_EXE_OUTPUT = -o $@ +ifeq ($(WITH_ZLIB),1) +LDLIBS += -lz +endif + +##CFLAGS += -Minform=info +CXXFLAGS = $(CFLAGS) -tused ifeq ($(DEBUG),1) else CFLAGS += -O2 diff --git a/src/acc/acc_cxx.h b/src/acc/acc_cxx.h index a4c1e142..d573468e 100644 --- a/src/acc/acc_cxx.h +++ b/src/acc/acc_cxx.h @@ -49,6 +49,8 @@ **************************************************************************/ #if defined(__ACC_CXX_DO_NEW) +#elif (ACC_CC_PGI) +# define __ACC_CXX_DO_NEW { return 0; } #else # define __ACC_CXX_DO_NEW ; #endif diff --git a/src/conf.h b/src/conf.h index 12ef13eb..db37a358 100644 --- a/src/conf.h +++ b/src/conf.h @@ -116,10 +116,12 @@ #undef linux #undef small #undef tos -#undef unix -#if defined(__DMC__) +#if defined(ACC_CC_DMC) # undef tell #endif +#if !defined(ACC_CC_PGI) +# undef unix +#endif #if defined(__DJGPP__) # undef sopen # undef __unix__ @@ -149,7 +151,7 @@ # define UPX_E_OK UCL_E_OK # define UPX_E_ERROR UCL_E_ERROR # define UPX_E_OUT_OF_MEMORY UCL_E_OUT_OF_MEMORY -# define __UPX_ENTRY __UCL_ENTRY +# define __UPX_CDECL __UCL_CDECL # endif #endif #if defined(WITH_NRV) diff --git a/src/help.cpp b/src/help.cpp index 219f5182..b8ae4e4a 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -62,6 +62,8 @@ void show_head(void) UPX_VERSION_DATE); fg = con_fg(f,fg); #undef V + + UNUSED(fg); } @@ -275,6 +277,8 @@ void show_help(int x) "\n"); fg = con_fg(f,fg); #endif + + UNUSED(fg); } @@ -314,6 +318,8 @@ void show_license(void) " \n" ); fg = con_fg(f,fg); + + UNUSED(fg); } diff --git a/src/main.cpp b/src/main.cpp index ee822023..fb826ad6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -344,12 +344,12 @@ static void set_script_name(const char *n, bool allow_m) fprintf(stderr,"%s: missing script name\n",argv0); e_usage(); } - if (strlen(n) >= (size_t)opt->unix.SCRIPT_MAX - 3) + if (strlen(n) >= (size_t)opt->o_unix.SCRIPT_MAX - 3) { fprintf(stderr,"%s: script name too long\n",argv0); e_usage(); } - opt->unix.script_name = n; + opt->o_unix.script_name = n; done_script_name++; } @@ -685,18 +685,18 @@ static int do_option(int optc, const char *arg) opt->atari_tos.split_segments = true; break; case 660: - getoptvar(&opt->unix.blocksize, 8192u, ~0u); + getoptvar(&opt->o_unix.blocksize, 8192u, ~0u); break; case 661: - opt->unix.force_execve = true; + opt->o_unix.force_execve = true; break; case 662: - opt->unix.script_name = "/usr/local/lib/upx/upxX"; + opt->o_unix.script_name = "/usr/local/lib/upx/upxX"; if (mfx_optarg && mfx_optarg[0]) set_script_name(mfx_optarg,1); break; case 663: - opt->unix.ptinterp = true; + opt->o_unix.ptinterp = true; break; case 670: opt->ps1_exe.no_align = true; @@ -1242,6 +1242,7 @@ int __acc_cdecl_main main(int argc, char *argv[]) int fg = con_fg(f,FG_RED); con_fprintf(f,"\nWARNING: this is an unstable beta version - use for testing only! Really.\n"); fg = con_fg(f,fg); + UNUSED(fg); } #endif diff --git a/src/msg.cpp b/src/msg.cpp index 992020fe..e226e543 100644 --- a/src/msg.cpp +++ b/src/msg.cpp @@ -103,6 +103,7 @@ static void pr_error(const char *iname, const char *msg, bool is_warning) fg = con_fg(stderr,fg); UNUSED(is_warning); + UNUSED(fg); } diff --git a/src/options.h b/src/options.h index 6fe5e4a5..e481dcda 100644 --- a/src/options.h +++ b/src/options.h @@ -117,7 +117,7 @@ struct options_t { bool ptinterp; // is PT_INTERP, so don't adjust auxv_t enum { SCRIPT_MAX = 32 }; const char *script_name; - } unix; + } o_unix; struct { bool le; } watcom_le; diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 2e91e61a..baab72bc 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -90,7 +90,7 @@ PackLinuxI386elf::buildLoader(const Filter *ft) unsigned char tmp[sizeof(linux_i386elf_fold)]; memcpy(tmp, linux_i386elf_fold, sizeof(linux_i386elf_fold)); checkPatch(NULL, 0, 0, 0); // reset - if (opt->unix.ptinterp) { + if (opt->o_unix.ptinterp) { unsigned j; for (j = 0; j < sizeof(linux_i386elf_fold)-1; ++j) { if (0x60==tmp[ j] @@ -162,7 +162,7 @@ bool PackLinuxI386elf::canPack() assert(exetype == 1); // set options - opt->unix.blocksize = blocksize = file_size; + opt->o_unix.blocksize = blocksize = file_size; return true; } diff --git a/src/p_lx_exc.cpp b/src/p_lx_exc.cpp index 9fc83f45..e138edfd 100644 --- a/src/p_lx_exc.cpp +++ b/src/p_lx_exc.cpp @@ -472,7 +472,7 @@ bool PackLinuxI386::canPack() { // NOTE: ELF executables are now handled by p_lx_elf.cpp, // so we only handle them here if force_execve - if (elf == 0 && opt->unix.force_execve) + if (elf == 0 && opt->o_unix.force_execve) exetype = 1; } else if (l == 0x00640107 || l == 0x00640108 || l == 0x0064010b || l == 0x006400cc) diff --git a/src/p_lx_sep.cpp b/src/p_lx_sep.cpp index 1c3086da..de2caa86 100644 --- a/src/p_lx_sep.cpp +++ b/src/p_lx_sep.cpp @@ -42,7 +42,7 @@ // **************************************************************************/ -//#define SCRIPT_SIZE (opt->unix.SCRIPT_MAX + sizeof(l_info)) +//#define SCRIPT_SIZE (opt->o_unix.SCRIPT_MAX + sizeof(l_info)) #define SCRIPT_SIZE (32 + sizeof(l_info)) const upx_byte *PackLinuxI386sep::getLoader() const @@ -50,7 +50,7 @@ const upx_byte *PackLinuxI386sep::getLoader() const static char script[SCRIPT_SIZE]; memset(script, 0, sizeof(script)); - char const *name = opt->unix.script_name; + char const *name = opt->o_unix.script_name; if (0==name) { name = "/usr/local/lib/upxX"; } @@ -77,7 +77,7 @@ int PackLinuxI386sep::getLoaderSize() const int PackLinuxI386sep::getLoaderPrefixSize() const { - return opt->unix.SCRIPT_MAX; + return opt->o_unix.SCRIPT_MAX; } void PackLinuxI386sep::patchLoader() diff --git a/src/p_unix.cpp b/src/p_unix.cpp index c7b9323e..c64208fc 100644 --- a/src/p_unix.cpp +++ b/src/p_unix.cpp @@ -120,8 +120,7 @@ void PackUnix::pack1(OutputFile * /*fo*/, Filter & /*ft*/) // derived class usually provides this } -int -PackUnix::getStrategy(Filter &/*ft*/) +int PackUnix::getStrategy(Filter &/*ft*/) { // Called just before reading and compressing each block. // Might want to adjust blocksize, etc. @@ -250,7 +249,7 @@ void PackUnix::pack(OutputFile *fo) progid = 0; // set options - blocksize = opt->unix.blocksize; + blocksize = opt->o_unix.blocksize; if (blocksize <= 0) blocksize = BLOCKSIZE; if ((off_t)blocksize > file_size) diff --git a/src/packmast.cpp b/src/packmast.cpp index 14e5bd8b..c0f0a83c 100644 --- a/src/packmast.cpp +++ b/src/packmast.cpp @@ -194,7 +194,7 @@ static Packer* try_packers(InputFile *f, try_function func) // // linux // - if (!opt->unix.force_execve) + if (!opt->o_unix.force_execve) { #if 0 if (opt->unix.script_name) diff --git a/src/ui.cpp b/src/ui.cpp index 79effb2a..6614e733 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -393,7 +393,7 @@ void UiPacker::endCallback() // the callback **************************************************************************/ -void __UPX_ENTRY UiPacker::callback(upx_uint isize, upx_uint osize, int state, void *user) +void __UPX_CDECL UiPacker::callback(upx_uint isize, upx_uint osize, int state, void *user) { //printf("%6d %6d %d\n", isize, osize, state); if (state != -1 && state != 3) return; diff --git a/src/ui.h b/src/ui.h index 53c6f815..f0ae33b4 100644 --- a/src/ui.h +++ b/src/ui.h @@ -81,7 +81,7 @@ public: virtual void endCallback(); virtual cb_t *getCallback() { return &cb; } protected: - static void __UPX_ENTRY callback(upx_uint isize, upx_uint osize, + static void __UPX_CDECL callback(upx_uint isize, upx_uint osize, int, void *); virtual void doCallback(unsigned isize, unsigned osize);