mirror of https://github.com/upx/upx.git
Minor cleanups.
This commit is contained in:
parent
01cd5fe0d5
commit
2f41ece017
23
src/Makefile
23
src/Makefile
|
@ -51,19 +51,6 @@ ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
|||
DEFS += -DWITH_LZMA
|
||||
INCLUDES += -I$(UPX_LZMADIR)
|
||||
endif
|
||||
# you should set envvar UPX_LUADIR to point to your unpacked lua-5.1.1.tar.gz
|
||||
# [disabled for now]
|
||||
ifneq ($(wildcard $(UPX_LUADIR)/src/lua.h),)
|
||||
##DEFS += -DWITH_LUA
|
||||
##upx_SOURCES_LUA := $(wildcard $(UPX_LUADIR)/src/*.c)
|
||||
##upx_SOURCES_LUA := $(filter-out %lua.c, $(upx_SOURCES_LUA))
|
||||
##upx_SOURCES_LUA := $(filter-out %luac.c, $(upx_SOURCES_LUA))
|
||||
##upx_OBJECTS_LUA := $(notdir $(upx_SOURCES_LUA:.c=$(objext)))
|
||||
##upx_OBJECTS_LUA := $(addprefix lua_,$(upx_OBJECTS_LUA))
|
||||
##upx_OBJECTS += $(upx_OBJECTS_LUA)
|
||||
else
|
||||
##$(error please set UPX_LUADIR)
|
||||
endif
|
||||
|
||||
|
||||
all: upx$(exeext)
|
||||
|
@ -86,16 +73,6 @@ compress_lzma$(objext) : CXXFLAGS += -Wno-unused
|
|||
##compress_lzma$(objext) : CXXFLAGS += -Wno-error
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(upx_OBJECTS_LUA)),)
|
||||
$(upx_OBJECTS_LUA) : lua_%.o : $(UPX_LUADIR)/src/%.c
|
||||
$(strip $(CXX) $(call e,CPPFLAGS) $(call e,CXXFLAGS) -o $@ -c $<)
|
||||
ifeq ($(USE_GNUC),1)
|
||||
$(upx_OBJECTS_LUA) : CXXFLAGS += -Wno-cast-align
|
||||
$(upx_OBJECTS_LUA) : CXXFLAGS += -Wno-cast-qual
|
||||
$(upx_OBJECTS_LUA) : CXXFLAGS += -Wno-error
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
mostlyclean clean distclean maintainer-clean:
|
||||
rm -f *.d *.map *.o *.obj *.res upx.exe upx.out upx.ttp upx$(exeext)
|
||||
|
|
60
src/conf.h
60
src/conf.h
|
@ -202,16 +202,8 @@ typedef void (__acc_cdecl *upx_progress_func_t)
|
|||
|
||||
struct upx_callback_t
|
||||
{
|
||||
#if 0
|
||||
upx_alloc_func_t nalloc;
|
||||
upx_free_func_t nfree;
|
||||
#endif
|
||||
upx_progress_func_t nprogress;
|
||||
void * user1;
|
||||
#if 0
|
||||
unsigned user2;
|
||||
unsigned user3;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -222,18 +214,6 @@ struct upx_callback_t
|
|||
// malloc debuggers
|
||||
#if defined(WITH_VALGRIND)
|
||||
# include <valgrind/memcheck.h>
|
||||
#elif defined(WITH_DMALLOC)
|
||||
# define DMALLOC_FUNC_CHECK
|
||||
# include <dmalloc.h>
|
||||
#elif defined(WITH_GC)
|
||||
# define GC_DEBUG
|
||||
# include <gc/gc.h>
|
||||
# undef malloc
|
||||
# undef realloc
|
||||
# undef free
|
||||
# define malloc GC_MALLOC
|
||||
# define realloc GC_REALLOC
|
||||
# define free GC_FREE
|
||||
#endif
|
||||
|
||||
#if !defined(VALGRIND_MAKE_WRITABLE)
|
||||
|
@ -251,6 +231,7 @@ struct upx_callback_t
|
|||
#endif
|
||||
|
||||
|
||||
// unconditionally turn on assertions
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
|
@ -385,39 +366,6 @@ struct upx_callback_t
|
|||
|
||||
#define UPX_MAX(a,b) ((a) >= (b) ? (a) : (b))
|
||||
#define UPX_MIN(a,b) ((a) <= (b) ? (a) : (b))
|
||||
#define UPX_MAX3(a,b,c) ((a) >= (b) ? UPX_MAX(a,c) : UPX_MAX(b,c))
|
||||
#define UPX_MIN3(a,b,c) ((a) <= (b) ? UPX_MIN(a,c) : UPX_MIN(b,c))
|
||||
|
||||
|
||||
#if 0 && defined(__cplusplus) && !defined(new) && !defined(delete)
|
||||
// global operators - debug
|
||||
inline void *operator new(size_t l)
|
||||
{
|
||||
void *p = malloc(l);
|
||||
printf("new %6ld %p\n",(long)l,p);
|
||||
fflush(stdout);
|
||||
return p;
|
||||
}
|
||||
inline void *operator new[](size_t l)
|
||||
{
|
||||
void *p = malloc(l);
|
||||
printf("new[] %6ld %p\n",(long)l,p);
|
||||
fflush(stdout);
|
||||
return p;
|
||||
}
|
||||
inline void operator delete(void *p)
|
||||
{
|
||||
printf("delete %p\n",p);
|
||||
fflush(stdout);
|
||||
if (p) free(p);
|
||||
}
|
||||
inline void operator delete[](void *p)
|
||||
{
|
||||
printf("delete[] %p\n",p);
|
||||
fflush(stdout);
|
||||
if (p) free(p);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// An Array allocates memory on the heap, but automatically
|
||||
|
@ -498,7 +446,6 @@ inline void operator delete[](void *p)
|
|||
#define UPX_F_WINCE_ARM_PE 21
|
||||
#define UPX_F_LINUX_ELF64_AMD 22
|
||||
#define UPX_F_LINUX_ELF32_ARMLE 23
|
||||
|
||||
#define UPX_F_BSD_i386 24
|
||||
#define UPX_F_BSD_ELF_i386 25
|
||||
#define UPX_F_BSD_SH_i386 26
|
||||
|
@ -613,11 +560,10 @@ struct ucl_compress_result_t
|
|||
|
||||
struct upx_compress_result_t
|
||||
{
|
||||
#if 1
|
||||
// debug
|
||||
int method, level;
|
||||
unsigned u_len, c_len;
|
||||
#endif
|
||||
|
||||
lzma_compress_result_t result_lzma;
|
||||
ucl_compress_result_t result_ucl;
|
||||
|
||||
|
@ -698,7 +644,7 @@ void do_files(int i, int argc, char *argv[]);
|
|||
|
||||
// help.cpp
|
||||
void show_head(void);
|
||||
void show_help(int x = 0);
|
||||
void show_help(int verbose=0);
|
||||
void show_license(void);
|
||||
void show_usage(void);
|
||||
void show_version(int);
|
||||
|
|
|
@ -89,7 +89,7 @@ void show_usage(void)
|
|||
//
|
||||
**************************************************************************/
|
||||
|
||||
void show_help(int x)
|
||||
void show_help(int x/*verbose*/)
|
||||
{
|
||||
FILE *f = con_term;
|
||||
int fg;
|
||||
|
|
|
@ -586,8 +586,8 @@ i386-linux.kernel.vmlinu%.h : $(srcdir)/src/$$T.S
|
|||
$(call tc,bin2h) --ident=nrv_loader tmp/$T.bin $@
|
||||
|
||||
i386-linux.kernel.vmlinux-head.h : $(srcdir)/src/$$T.S
|
||||
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.tmp
|
||||
$(call tc,objcopy) --output-target binary --only-section .text tmp/$T.tmp tmp/$T.bin
|
||||
$(call tc,gcc) -c -x assembler-with-cpp $< -o tmp/$T.o
|
||||
$(call tc,objcopy) --output-target binary --only-section .text tmp/$T.o tmp/$T.bin
|
||||
$(call tc,bin2h) --ident=head_stack tmp/$T.bin $@
|
||||
|
||||
|
||||
|
@ -641,7 +641,7 @@ ifeq (1,1)
|
|||
$(call tc,as) tmp/$T.i -o tmp/$T.bin
|
||||
$(call tc,gpp_mkdep) --mode=c --MMD=$@ $< --MF=tmp/$T.d
|
||||
else
|
||||
# info: as-2.16.1 does not work
|
||||
# info: as-2.16.1 as used by gcc-4.1.1 does _not_ work
|
||||
$(call tc,gcc) -c -DPS1 -Wa,-O,-mno-pdr $< -o tmp/$T.bin
|
||||
endif
|
||||
$(call tc,f-embed_objinfo,tmp/$T.bin)
|
||||
|
|
Loading…
Reference in New Issue