From 78364ac830152b8ac77eb73f196d1203ae45c2cd Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Wed, 31 Jan 2007 14:28:15 +0100 Subject: [PATCH] Small Watcom updates. --- src/stub/src/arch/i086/Makefile.extra | 14 +++++++++----- src/stub/src/c/lzma_d_c.c | 22 ++++++++++++++++++---- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/stub/src/arch/i086/Makefile.extra b/src/stub/src/arch/i086/Makefile.extra index 125df2e5..82f10c0b 100644 --- a/src/stub/src/arch/i086/Makefile.extra +++ b/src/stub/src/arch/i086/Makefile.extra @@ -23,7 +23,7 @@ endif -include $(top_srcdir)/Makevars.global ./Makevars.local vpath %.c $(top_srcdir)/src/stub/src/c -export WATCOM ?= /opt/cc-i386-linux/watcom/open-watcom-1.6 +##export WATCOM ?= /opt/cc-i386-linux/watcom/open-watcom-1.6 STUBS = ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),) @@ -48,17 +48,19 @@ lzma_d_c%.S : tc_list = method-lzma default lzma_d_c%.S : tc_bfdname = c := tc.method-lzma.wcc -$c = $(WATCOM)/binl/wcc -zq -0 -$c += -mh +$c = $(WATCOM)/binl/wcc -zq -bt=dos -0 +$c += -mc $c += -zm -zc $c += -os -s -d0 $c += -w5 -we -fr=/dev/null +$c += -D__INT_MAX__=32767 $c += -D_LZMA_UINT32_IS_ULONG=1 $c += -I$(UPX_LZMADIR) $c += -I$(top_srcdir)/src -tc.method-lzma.wdis = $(WATCOM)/binl/wdis -tc.method-lzma.wdump = $(WATCOM)/binl/wdump +tc.method-lzma.dmpobj = $(WATCOM)/binl/dmpobj +tc.method-lzma.wdis = $(WATCOM)/binl/wdis +tc.method-lzma.wdump = $(WATCOM)/binl/wdump lzma_d_c%.S : lzma_d_c.c $(call tc,wcc) $(PP_FLAGS) -fo=tmp/$T.obj $< @@ -73,3 +75,5 @@ FIXME: lzma_d_cf.% : PP_FLAGS = -DFAST lzma_d_cs.% : PP_FLAGS = -DSMALL +lzma_d_cf.% : LABEL_PREFIX = .Lf +lzma_d_cs.% : LABEL_PREFIX = .Ls diff --git a/src/stub/src/c/lzma_d_c.c b/src/stub/src/c/lzma_d_c.c index b00b7981..f9de2476 100644 --- a/src/stub/src/c/lzma_d_c.c +++ b/src/stub/src/c/lzma_d_c.c @@ -30,7 +30,7 @@ **************************************************************************/ #define ACC_LIBC_NAKED 1 -#define ACC_OS_FREESTANDING 1 +/*#define ACC_OS_FREESTANDING 1*/ #include "miniacc.h" #if 0 @@ -39,6 +39,10 @@ #undef _LZMA_PROB32 #undef _LZMA_LOC_OPT #endif +#if (ACC_ARCH_I086) && (ACC_CC_WATCOMC) + typedef unsigned char __huge Byte; +# define _7ZIP_BYTE_DEFINED 1 +#endif #if 0 @@ -51,10 +55,12 @@ ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(CLzmaDecoderState) == 16) #else -#define CLzmaDecoderState CLzmaDecoderState_dummy -#define LzmaDecode LzmaDecode_dummy +#define CLzmaDecoderState CLzmaDecoderState_dummy +#define LzmaDecodeProperties LzmaDecodeProperties_dummy +#define LzmaDecode LzmaDecode_dummy #include "C/7zip/Compress/LZMA_C/LzmaDecode.h" #undef CLzmaDecoderState +#undef LzmaDecodeProperties #undef LzmaDecode typedef struct { struct { unsigned char lc, lp, pb, dummy; } Properties; @@ -65,8 +71,16 @@ typedef struct { #endif } CLzmaDecoderState; ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(CLzmaDecoderState) == 32768) +ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(SizeT) >= 4) -#if defined(__WATCOMC__) +#if (ACC_ARCH_I086) && (ACC_CC_WATCOMC) +# if (ACC_MM_HUGE) + typedef unsigned short __far MyCProb; +# undef CProb +# define CProb MyCProb +# endif +# define char char __huge +#elif (ACC_CC_WATCOMC) #else #define CLzmaDecoderState const CLzmaDecoderState #endif