From 9b1b7036b0de2150a62088d4681e966d721fc012 Mon Sep 17 00:00:00 2001 From: Joe Mistachkin Date: Sun, 13 Aug 2017 22:05:25 +0000 Subject: Support cross-compiling Tcl for 'Win32 on ARM' using Visual Studio. --- generic/tclPanic.c | 2 +- win/makefile.vc | 11 +++++++++-- win/tclWin32Dll.c | 4 ++-- win/tclWinFile.c | 2 +- win/tclWinSock.c | 3 +-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/generic/tclPanic.c b/generic/tclPanic.c index b032449..b03ad41 100644 --- a/generic/tclPanic.c +++ b/generic/tclPanic.c @@ -111,7 +111,7 @@ Tcl_PanicVA( __builtin_trap(); # elif defined(_WIN64) __debugbreak(); -# elif defined(_MSC_VER) +# elif defined(_MSC_VER) && defined (_M_IX86) _asm {int 3} # else DebugBreak(); diff --git a/win/makefile.vc b/win/makefile.vc index ada08cc..40de392 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -121,7 +121,7 @@ the build instructions. # nodep = Turns off compatibility macros to ensure the core # isn't being built with deprecated functions. # -# MACHINE=(ALPHA|AMD64|IA64|IX86) +# MACHINE=(ARM|AMD64|IA64|IX86) # Set the machine type used for the compiler, linker, and # resource compiler. This hook is needed to tell the tools # when alternate platforms are requested. IX86 is the default @@ -484,9 +484,16 @@ cdebug = -Zi -Od $(DEBUGFLAGS) cdebug = -Zi -WX $(DEBUGFLAGS) !endif +### Common compiler options that are architecture specific +!if "$(MACHINE)" == "ARM" +carch = -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE +!else +carch = +!endif + ### Declarations common to all compiler options cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ +cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ !if $(MSVCRT) !if $(DEBUG) && !$(UNCHECKED) diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 688fa8d..84c7a97 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -29,7 +29,7 @@ static int platformId; /* Running under NT, or 95/98? */ * VC++ 5.x has no 'cpuid' assembler instruction, so we must emulate it */ -#if defined(_MSC_VER) && (_MSC_VER <= 1100) +#if defined(_MSC_VER) && (_MSC_VER <= 1100) && defined (_M_IX86) #define cpuid __asm __emit 0fh __asm __emit 0a2h #endif @@ -735,7 +735,7 @@ TclWinCPUID( __cpuid(regsPtr, index); status = TCL_OK; -# else +# elif defined (_M_IX86) /* * Define a structure in the stack frame to hold the registers. */ diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 6662327..7586af1 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -828,7 +828,7 @@ tclWinDebugPanic( __builtin_trap(); #elif defined(_WIN64) __debugbreak(); -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && defined (_M_IX86) _asm {int 3} #else DebugBreak(); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index da2e60a..3799d98 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1426,8 +1426,7 @@ TcpGetOptionProc( flags |= NI_NUMERICHOST; } } else if (sockname.sa.sa_family == AF_INET6) { - if ((IN6_ARE_ADDR_EQUAL(&sockname.sa6.sin6_addr, - &in6addr_any)) || + if (IN6_IS_ADDR_UNSPECIFIED(&sockname.sa6.sin6_addr) || (IN6_IS_ADDR_V4MAPPED(&sockname.sa6.sin6_addr) && sockname.sa6.sin6_addr.s6_addr[12] == 0 && sockname.sa6.sin6_addr.s6_addr[13] == 0 -- cgit v0.12 From 8e69db979dd54dd5edf2a4ee6c7283748660ca8a Mon Sep 17 00:00:00 2001 From: Joe Mistachkin Date: Sun, 13 Aug 2017 22:15:30 +0000 Subject: Always define '_USING_V110_SDK71_', in case targeting the pre-Windows 8.x SDKs. --- win/rules.vc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/rules.vc b/win/rules.vc index 4a3ae26..979fb14 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -159,7 +159,7 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif -COMPILERFLAGS =-W3 /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING +COMPILERFLAGS =-W3 -DUNICODE -D_UNICODE -D_USING_V110_SDK71_ -D_ATL_XP_TARGETING # In v13 -GL and -YX are incompatible. !if [nmakehlp -c -YX] -- cgit v0.12 From a18c3eca9bb851589fcb45fbcef0d8be43396a15 Mon Sep 17 00:00:00 2001 From: Joe Mistachkin Date: Sun, 13 Aug 2017 22:31:19 +0000 Subject: The 'clean' target should delete the generated 'nmhlp-out.txt' file as well. --- win/makefile.vc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/win/makefile.vc b/win/makefile.vc index 40de392..e0d8d9d 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -1229,6 +1229,8 @@ clean: clean-pkgs @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj @echo Cleaning $(WINDIR)\nmakehlp.exe ... @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe + @echo Cleaning $(WINDIR)\nmhlp-out.txt ... + @if exist $(WINDIR)\nmhlp-out.txt del $(WINDIR)\nmhlp-out.txt @echo Cleaning $(WINDIR)\_junk.pch ... @if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch @echo Cleaning $(WINDIR)\vercl.x ... -- cgit v0.12