diff --git a/Mkfiles/openwcom.mak b/Mkfiles/openwcom.mak index d0ba5128..631b0aaf 100644 --- a/Mkfiles/openwcom.mak +++ b/Mkfiles/openwcom.mak @@ -4,9 +4,11 @@ # cross-compile on a DOS/Win32/OS2 platform host # +.DEFAULT : what + top_srcdir = . srcdir = . -VPATH = $(srcdir)\asm;$(srcdir)\x86;asm;x86;$(srcdir)\macros;macros;$(srcdir)\output;$(srcdir)\lib;$(srcdir)\common;$(srcdir)\stdlib;$(srcdir)\nasmlib;$(srcdir)\disasm +VPATH = $(srcdir)\asm;$(srcdir)\x86;asm;x86;$(srcdir)\macros;macros;$(srcdir)\output;$(srcdir)\lib;$(srcdir)\common;$(srcdir)\stdlib;$(srcdir)\nasmlib;$(srcdir)\disasm;$(srcdir)\zlib prefix = C:\Program Files\NASM exec_prefix = $(prefix) bindir = $(prefix)\bin @@ -16,7 +18,7 @@ CC = *wcl386 DEBUG = CFLAGS = -zq -6 -ox -wx -wcd=124 -ze -fpi $(DEBUG) BUILD_CFLAGS = $(CFLAGS) $(%TARGET_CFLAGS) -INTERNAL_CFLAGS = -I$(srcdir) -I. -I$(srcdir)\include -I$(srcdir)\x86 -Ix86 -I$(srcdir)\asm -Iasm -I$(srcdir)\disasm -I$(srcdir)\output +INTERNAL_CFLAGS = -I$(srcdir) -I. -I$(srcdir)\include -I$(srcdir)\x86 -Ix86 -I$(srcdir)\asm -Iasm -I$(srcdir)\disasm -I$(srcdir)\output -I$(srcdir)\zlib ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) LD = *wlink LDEBUG = @@ -31,9 +33,9 @@ RUNPERL = $(PERL) $(PERLFLAGS) .BEFORE set COPYCMD=/y -RM_F = -del /f +RM_F = -rm -f LN_S = copy -EMPTY = copy nul: +EMPTY = %create SIDE = %null Created by side effect MAKENSIS = makensis @@ -149,15 +151,23 @@ LIBOBJ_DIS = & # Objects for the local copy of zlib. The variable ZLIB is set to # $(ZLIBOBJ) if the internal version of zlib should be used. +# zlib\crc32.obj is renamed to zlib\z_crc32.obj to avoid conflicts with +# nasmlib\crc32.obj. ZLIBOBJ = & zlib\adler32.obj & - zlib\crc32.obj & + zlib\z_crc32.obj & zlib\infback.obj & zlib\inffast.obj & zlib\inflate.obj & zlib\inftrees.obj & zlib\zutil.obj +# Special rule to avoid conflicts with nasmlib\crc32.obj because of stupid +# behavior of implicit rules and VPATH of Open Watcom Make. +zlib\z_crc32.obj : zlib\crc32.c + @set INCLUDE= + $(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@ + LIBOBJ = $(LIBOBJ_W) $(LIBOBJ_NW) $(ZLIB) ALLOBJ_W = $(NASM) $(LIBOBJ_W) ALLOBJ = $(PROGOBJ) $(LIBOBJ) diff --git a/asm/assemble.c b/asm/assemble.c index 4aeb2d43..da12940a 100644 --- a/asm/assemble.c +++ b/asm/assemble.c @@ -3103,6 +3103,7 @@ static enum match_result matches(const struct itemplate * const itemp, * If this is an *explicitly* sized immediate, * allow it to match an extending pattern. */ +#ifndef __WATCOMC__ switch (isize[i]) { case BITS8: if (ttype & BYTEEXTMASK) { @@ -3117,6 +3118,18 @@ static enum match_result matches(const struct itemplate * const itemp, default: break; } +#else + /* Open Watcom does not support 64-bit constants at *case*. */ + if (isize[i] == BITS8) { + if (ttype & BYTEEXTMASK) { + isize[i] = tsize[i]; + itype[i] |= BYTEEXTMASK; + } + } else if (isize[i] == BITS32) { + if (ttype & DWORDEXTMASK) + isize[i] = tsize[i]; + } +#endif /* * MOST instructions which take an sdword64 are the only form; diff --git a/disasm/disasm.c b/disasm/disasm.c index 0f421f80..c9e82e16 100644 --- a/disasm/disasm.c +++ b/disasm/disasm.c @@ -113,6 +113,7 @@ static enum reg_enum whichreg(opflags_t regflags, int regval, uint32_t rex) */ static enum reg_enum implicit_reg(opflags_t regflags) { +#ifndef __WATCOMC__ switch (regflags) { case REG_AL: return R_AL; case REG_AX: return R_AX; @@ -139,6 +140,56 @@ static enum reg_enum implicit_reg(opflags_t regflags) case OPMASK0: return R_K0; default: return 0; } +#else + /* Open Watcom does not support 64-bit constants at *case*. */ + if (regflags == REG_AL) + return R_AL; + if (regflags == REG_AX) + return R_AX; + if (regflags == REG_EAX) + return R_EAX; + if (regflags == REG_RAX) + return R_RAX; + if (regflags == REG_DL) + return R_DL; + if (regflags == REG_DX) + return R_DX; + if (regflags == REG_EDX) + return R_EDX; + if (regflags == REG_RDX) + return R_RDX; + if (regflags == REG_CL) + return R_CL; + if (regflags == REG_CX) + return R_CX; + if (regflags == REG_ECX) + return R_ECX; + if (regflags == REG_RCX) + return R_RCX; + if (regflags == FPU0) + return R_ST0; + if (regflags == XMM0) + return R_XMM0; + if (regflags == YMM0) + return R_YMM0; + if (regflags == ZMM0) + return R_ZMM0; + if (regflags == REG_ES) + return R_ES; + if (regflags == REG_CS) + return R_CS; + if (regflags == REG_SS) + return R_SS; + if (regflags == REG_DS) + return R_DS; + if (regflags == REG_FS) + return R_FS; + if (regflags == REG_GS) + return R_GS; + if (regflags == OPMASK0) + return R_K0; + return 0; +#endif } /*