summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-12-13 21:23:59 (GMT)
committernijtmans <nijtmans>2010-12-13 21:23:59 (GMT)
commit716be31fd7cb8acae5bba8b10425b904f8ace0dc (patch)
treeb2163166f4f1a1b642799c861fc05ecf29b4d279 /win
parent899c51483b58eceb78b4fc34ae8b0c6ff59d8db6 (diff)
downloadtk-716be31fd7cb8acae5bba8b10425b904f8ace0dc.zip
tk-716be31fd7cb8acae5bba8b10425b904f8ace0dc.tar.gz
tk-716be31fd7cb8acae5bba8b10425b904f8ace0dc.tar.bz2
Cross-compile support for Win and UNIX (backported)
Diffstat (limited to 'win')
-rwxr-xr-xwin/configure11
-rw-r--r--win/tcl.m410
-rw-r--r--win/tkWin32Dll.c87
-rw-r--r--win/tkWinX.c4
4 files changed, 96 insertions, 16 deletions
diff --git a/win/configure b/win/configure
index dec3ff5..ebb3eb5 100755
--- a/win/configure
+++ b/win/configure
@@ -3390,10 +3390,6 @@ echo "${ECHO_T}yes" >&6
echo "$as_me:$LINENO: checking compiler flags" >&5
echo $ECHO_N "checking compiler flags... $ECHO_C" >&6
if test "${GCC}" = "yes" ; then
- if test "$do64bit" != "no" ; then
- { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on Windows" >&5
-echo "$as_me: WARNING: 64bit mode not supported with GCC on Windows" >&2;}
- fi
SHLIB_LD=""
SHLIB_LD_LIBS=""
LIBS="-lws2_32"
@@ -3501,8 +3497,11 @@ echo "$as_me: error: ${CC} does not support the -shared option.
LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}"
LDFLAGS_WINDOW="-mwindows ${extra_ldflags}"
- # gcc under Windows supports only 32bit builds
- MACHINE="X86"
+ if test "$do64bit" != "no" ; then
+ MACHINE="AMD64"
+ else
+ MACHINE="X86"
+ fi
else
if test "${SHARED_BUILD}" = "0" ; then
# static
diff --git a/win/tcl.m4 b/win/tcl.m4
index 77bf2ca..4de8400 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -441,9 +441,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_MSG_CHECKING([compiler flags])
if test "${GCC}" = "yes" ; then
- if test "$do64bit" != "no" ; then
- AC_MSG_WARN([64bit mode not supported with GCC on Windows])
- fi
SHLIB_LD=""
SHLIB_LD_LIBS=""
LIBS="-lws2_32"
@@ -546,8 +543,11 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}"
LDFLAGS_WINDOW="-mwindows ${extra_ldflags}"
- # gcc under Windows supports only 32bit builds
- MACHINE="X86"
+ if test "$do64bit" != "no" ; then
+ MACHINE="AMD64"
+ else
+ MACHINE="X86"
+ fi
else
if test "${SHARED_BUILD}" = "0" ; then
# static
diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c
index 3978f1c..733d2b1 100644
--- a/win/tkWin32Dll.c
+++ b/win/tkWin32Dll.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWin32Dll.c,v 1.12 2005/12/02 00:19:04 dkf Exp $
+ * RCS: @(#) $Id: tkWin32Dll.c,v 1.12.4.1 2010/12/13 21:23:59 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -90,13 +90,22 @@ DllEntryPoint(
* Always TRUE.
*
* Side effects:
- * This might call some sycronization functions, but MSDN documentation
+ * This might call some synchronization functions, but MSDN documentation
* states: "Waiting on synchronization objects in DllMain can cause a
* deadlock."
*
*----------------------------------------------------------------------
*/
+#if defined(HAVE_NO_SEH) && defined(_WIN64)
+/* A little trick to make the assembler code below
+ * compile on Win64 with gcc: It appears that Win64
+ * does not decorate compiled functions with "_"
+ */
+static void _TkFinalize(ClientData clientData) __attribute__((used));
+static void _TkFinalize(ClientData clientData) {TkFinalize(clientData);}
+#endif
+
BOOL APIENTRY
DllMain(
HINSTANCE hInstance,
@@ -125,6 +134,77 @@ DllMain(
*/
#ifdef HAVE_NO_SEH
+# ifdef __WIN64
+ __asm__ __volatile__ (
+
+ /*
+ * Construct an EXCEPTION_REGISTRATION to protect the call to
+ * TkFinalize
+ */
+
+ "leaq %[registration], %%rdx" "\n\t"
+ "movq %%gs:0, %%rax" "\n\t"
+ "movq %%rax, 0x0(%%edx)" "\n\t" /* link */
+ "leaq 1f, %%rax" "\n\t"
+ "movq %%rax, 0x8(%%rdx)" "\n\t" /* handler */
+ "movq %%rbp, 0x10(%%rdx)" "\n\t" /* ebp */
+ "movq %%rsp, 0x18(%%rdx)" "\n\t" /* esp */
+ "movl %[error], 0x20(%%rdx)" "\n\t" /* status */
+
+ /*
+ * Link the EXCEPTION_REGISTRATION on the chain
+ */
+
+ "movq %%rdx, %%gs:0" "\n\t"
+
+ /*
+ * Call TkFinalize
+ */
+
+ "movq $0x0, 0x0(%%esp)" "\n\t"
+ "call _TkFinalize" "\n\t"
+
+ /*
+ * Come here on a normal exit. Recover the EXCEPTION_REGISTRATION
+ * and store a TCL_OK status
+ */
+
+ "movq %%gs:0, %%rdx" "\n\t"
+ "movl %[ok], %%eax" "\n\t"
+ "movl %%eax, 0x20(%%rdx)" "\n\t"
+ "jmp 2f" "\n"
+
+ /*
+ * Come here on an exception. Get the EXCEPTION_REGISTRATION that
+ * we previously put on the chain.
+ */
+
+ "1:" "\t"
+ "movq %%gs:0, %%rdx" "\n\t"
+ "movq 0x10(%%rdx), %%rdx" "\n\t"
+
+ /*
+ * Come here however we exited. Restore context from the
+ * EXCEPTION_REGISTRATION in case the stack is unbalanced.
+ */
+
+ "2:" "\t"
+ "movq 0x18(%%rdx), %%rsp" "\n\t"
+ "movq 0x10(%%rdx), %%rbp" "\n\t"
+ "movq 0x0(%%rdx), %%rax" "\n\t"
+ "movq %%rax, %%gs:0" "\n\t"
+
+ :
+ /* No outputs */
+ :
+ [registration] "m" (registration),
+ [ok] "i" (TCL_OK),
+ [error] "i" (TCL_ERROR)
+ :
+ "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", "memory"
+ );
+
+# else
__asm__ __volatile__ (
/*
@@ -193,8 +273,9 @@ DllMain(
[error] "i" (TCL_ERROR)
:
"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory"
- );
+ );
+# endif
#else /* HAVE_NO_SEH */
__try {
/*
diff --git a/win/tkWinX.c b/win/tkWinX.c
index d99f1ec..62b2670 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.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: tkWinX.c,v 1.57.2.3 2010/05/20 22:43:23 dkf Exp $
+ * RCS: @(#) $Id: tkWinX.c,v 1.57.2.4 2010/12/13 21:23:59 nijtmans Exp $
*/
/*
@@ -30,7 +30,7 @@
*/
#ifndef _WIN32_IE
-#define _WIN32_IE 0x0300
+#define _WIN32_IE 0x0501 /* IE 5 */
#endif
#include <commctrl.h>