mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Compile fixes for PGI C++.
committer: mfx <mfx> 1071917829 +0000
This commit is contained in:
parent
b9c976304a
commit
97153e8e09
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
|||
" <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>\n"
|
||||
);
|
||||
fg = con_fg(f,fg);
|
||||
|
||||
UNUSED(fg);
|
||||
}
|
||||
|
||||
|
||||
|
|
13
src/main.cpp
13
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
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
2
src/ui.h
2
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user