diff options
author | nijtmans <nijtmans> | 2011-01-17 08:43:05 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2011-01-17 08:43:05 (GMT) |
commit | 0389645b34a0b9251ca8ea19bce38a41501cc991 (patch) | |
tree | 997046f50787786d5546f339d82c120a1e0b2ab2 /win | |
parent | c342aae64b0aa06acf5b0e56ac8809572824ee26 (diff) | |
download | tcl-0389645b34a0b9251ca8ea19bce38a41501cc991.zip tcl-0389645b34a0b9251ca8ea19bce38a41501cc991.tar.gz tcl-0389645b34a0b9251ca8ea19bce38a41501cc991.tar.bz2 |
handle --enable-64bit=ia64 for gcc. BACKPORT.
[Patch 3059922]: fixes for mingw64 - gcc4.5.1
Diffstat (limited to 'win')
-rwxr-xr-x | win/configure | 44 | ||||
-rw-r--r-- | win/tcl.m4 | 43 | ||||
-rw-r--r-- | win/tclWin32Dll.c | 50 |
3 files changed, 95 insertions, 42 deletions
diff --git a/win/configure b/win/configure index 67fde16..099c1cb 100755 --- a/win/configure +++ b/win/configure @@ -3966,6 +3966,10 @@ fi SHLIB_SUFFIX=".dll" + # MACHINE is IX86 for LINK, but this is used by the manifest, + # which requires x86|amd64|ia64. + MACHINE="X86" + # Check for a bug in gcc's windres that causes the # compile to fail when a Windows native path is # passed into windres. The mingw toolchain requires @@ -4117,11 +4121,18 @@ echo "$as_me: error: ${CC} does not support the -shared option. LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" - if test "$do64bit" != "no" ; then - MACHINE="AMD64" - else - MACHINE="X86" - fi + case "$do64bit" in + amd64|x64|yes) + MACHINE="AMD64" ; # assume AMD64 as default 64-bit build + echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 +echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 + ;; + ia64) + MACHINE="IA64" + echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 +echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 + ;; + esac else if test "${SHARED_BUILD}" = "0" ; then # static @@ -4151,12 +4162,9 @@ echo "${ECHO_T}using shared flags" >&6 # users of tclConfig.sh that may build shared or static. DLLSUFFIX="\${DBGX}.dll" - # This is a 2-stage check to make sure we have the 64-bit SDK - # We have to know where the SDK is installed. + # This is a 2-stage check to make sure we have the 64-bit SDK + # We have to know where the SDK is installed. # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs - # MACHINE is IX86 for LINK, but this is used by the manifest, - # which requires x86|amd64|ia64. - MACHINE="X86" if test "$do64bit" != "no" ; then if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft Platform SDK" @@ -4164,14 +4172,14 @@ echo "${ECHO_T}using shared flags" >&6 MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` PATH64="" case "$do64bit" in - amd64|x64|yes) - MACHINE="AMD64" ; # assume AMD64 as default 64-bit build - PATH64="${MSSDK}/Bin/Win64/x86/AMD64" - ;; - ia64) - MACHINE="IA64" - PATH64="${MSSDK}/Bin/Win64" - ;; + amd64|x64|yes) + MACHINE="AMD64" ; # assume AMD64 as default 64-bit build + PATH64="${MSSDK}/Bin/Win64/x86/AMD64" + ;; + ia64) + MACHINE="IA64" + PATH64="${MSSDK}/Bin/Win64" + ;; esac if test ! -d "${PATH64}" ; then { echo "$as_me:$LINENO: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5 @@ -373,6 +373,7 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [ # MAKE_DLL # # LIBSUFFIX +# LIBFLAGSUFFIX # LIBPREFIX # LIBRARIES # EXESUFFIX @@ -406,6 +407,10 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ SHLIB_SUFFIX=".dll" + # MACHINE is IX86 for LINK, but this is used by the manifest, + # which requires x86|amd64|ia64. + MACHINE="X86" + # Check for a bug in gcc's windres that causes the # compile to fail when a Windows native path is # passed into windres. The mingw toolchain requires @@ -543,11 +548,16 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" - if test "$do64bit" != "no" ; then - MACHINE="AMD64" - else - MACHINE="X86" - fi + case "$do64bit" in + amd64|x64|yes) + MACHINE="AMD64" ; # assume AMD64 as default 64-bit build + AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) + ;; + ia64) + MACHINE="IA64" + AC_MSG_RESULT([ Using 64-bit $MACHINE mode]) + ;; + esac else if test "${SHARED_BUILD}" = "0" ; then # static @@ -575,12 +585,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ # users of tclConfig.sh that may build shared or static. DLLSUFFIX="\${DBGX}.dll" - # This is a 2-stage check to make sure we have the 64-bit SDK - # We have to know where the SDK is installed. + # This is a 2-stage check to make sure we have the 64-bit SDK + # We have to know where the SDK is installed. # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs - # MACHINE is IX86 for LINK, but this is used by the manifest, - # which requires x86|amd64|ia64. - MACHINE="X86" if test "$do64bit" != "no" ; then if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft Platform SDK" @@ -588,14 +595,14 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ MSSDK=`echo "$MSSDK" | sed -e 's!\\\!/!g'` PATH64="" case "$do64bit" in - amd64|x64|yes) - MACHINE="AMD64" ; # assume AMD64 as default 64-bit build - PATH64="${MSSDK}/Bin/Win64/x86/AMD64" - ;; - ia64) - MACHINE="IA64" - PATH64="${MSSDK}/Bin/Win64" - ;; + amd64|x64|yes) + MACHINE="AMD64" ; # assume AMD64 as default 64-bit build + PATH64="${MSSDK}/Bin/Win64/x86/AMD64" + ;; + ia64) + MACHINE="IA64" + PATH64="${MSSDK}/Bin/Win64" + ;; esac if test ! -d "${PATH64}" ; then AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode]) diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index dd48003..41f8ce1 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWin32Dll.c,v 1.54.2.4 2010/11/19 20:34:47 nijtmans Exp $ + * RCS: @(#) $Id: tclWin32Dll.c,v 1.54.2.5 2011/01/17 08:43:05 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1054,12 +1054,42 @@ TclWinCPUID( unsigned int index, /* Which CPUID value to retrieve. */ unsigned int *regsPtr) /* Registers after the CPUID. */ { -#if defined(__GNUC__) && !defined(_WIN64) - EXCEPTION_REGISTRATION registration; -#endif int status = TCL_ERROR; -#if defined(__GNUC__) && !defined(_WIN64) +#if defined(__GNUC__) +# if defined(_WIN64) + /* + * Execute the CPUID instruction with the given index, and store results + * off 'regsPtr'. + */ + + __asm__ __volatile__( + /* + * Do the CPUID instruction, and save the results in the 'regsPtr' + * area. + */ + + "movl %[rptr], %%edi" "\n\t" + "movl %[index], %%eax" "\n\t" + "cpuid" "\n\t" + "movl %%eax, 0x0(%%edi)" "\n\t" + "movl %%ebx, 0x4(%%edi)" "\n\t" + "movl %%ecx, 0x8(%%edi)" "\n\t" + "movl %%edx, 0xc(%%edi)" "\n\t" + + : + /* No outputs */ + : + [index] "m" (index), + [rptr] "m" (regsPtr) + : + "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); + status = TCL_OK; + +# else + + EXCEPTION_REGISTRATION registration; + /* * Execute the CPUID instruction with the given index, and store results * off 'regPtr'. @@ -1141,7 +1171,14 @@ TclWinCPUID( "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"); status = registration.status; -#elif defined(_MSC_VER) && !defined(_WIN64) +# endif /* !_WIN64 */ +#elif defined(_MSC_VER) +# if defined(_WIN64) + + __cpuid(regsPtr, index); + status = TCL_OK; + +# else /* * Define a structure in the stack frame to hold the registers. */ @@ -1188,6 +1225,7 @@ TclWinCPUID( /* do nothing */ } +# endif #else /* * Don't know how to do assembly code for this compiler and/or |