Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2010-12-13
16:29 • Ticket [1910041fff] Support of gnu x86_64-pc-mingw SEH status still Closed w... artifact: 4ab4738314 user: nijtmans
16:29 • Ticket [1910041fff]: 4 changes artifact: 5214f370e3 user: nijtmans
2010-09-08
22:49 • Closed ticket [1910041fff]. artifact: 9c3af14cdc user: dgp
21:26 • Ticket [1910041fff]: 5 changes artifact: ddeca7103d user: dgp
21:02 • Ticket [1910041fff]: 5 changes artifact: 7912819f7b user: kennykb
20:38 • Ticket [1910041fff]: 4 changes artifact: e50e543821 user: dgp
20:38 • Add attachment kai-update.patch to ticket [1910041fff] artifact: 78c2f6c16e user: dgp
20:38 • Ticket [1910041fff] Support of gnu x86_64-pc-mingw SEH status still Open wit... artifact: 5f974e7fb1 user: dgp
03:29 • Ticket [1910041fff]: 1 change artifact: ca89101635 user: dgp
2008-06-14
22:56 • Ticket [1910041fff]: 4 changes artifact: 81291e3d24 user: nijtmans
2008-06-13
17:05 • Ticket [1910041fff]: 1 change artifact: c37d74df30 user: dkf
2008-03-08
19:10 • Add attachment kai.patch to ticket [1910041fff] artifact: 080df9bd63 user: ktietz70
19:10 • Ticket [1910041fff] Support of gnu x86_64-pc-mingw SEH status still Open wit... artifact: f05bbea24a user: ktietz70
12:10 • New ticket [1910041fff]. artifact: 545ff999b9 user: ktietz70

Support of gnu x86_64-pc-mingw SEH

Closed / Duplicate1910041fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 16 years ago
Descriptionplain2008-03-08 12:10:55
Hallo,

NightStrike and me prepared a patch for tcl to support for the gnu compiler the SEH emulation.
May you are interested in this.

Regards,
  Kai
ktietz70plain2008-03-08 19:10:56
File Added - 269546: kai.patch
dkf Ticket [1910041fff]: 1 change [History diff]2008-06-13 17:05:35
nijtmansplain2008-06-14 22:56:54
Logged In: YES 
user_id=61031
Originator: NO

Had a look at the patch. I'm not an assembler expert, but
the patch only contains x64 versions of already present
x32 assembler portions. Looks good! (Although I don't have
a Win64 system around to test it) I think it should be
checked in.
I hope that one day gcc will support SEH, then this portions
of assembler will not be necessary any more.
dgp Ticket [1910041fff]: 1 change [History diff]2010-09-08 03:29:46
dgpplain2010-09-08 20:38:05
File Added - 386004: kai-update.patch
dgpplain2010-09-08 20:38:32
Here's my attempt to update this patch
to the current 8.5.9 sources.  Needs testing.
kennykbplain2010-09-08 21:02:26
Is there an actual case where the SEH stuff is needed in 64-bit Windows?

I had an earlier patch for it, that I didn't apply because it's far from obvious that it's needed.

SEH appears in the following places in the code.

(1) tclWin32Dll.c (TclWinCPUID) - Conditioned away on Win64; protects the CPUID instruction from causing an illegal operation exception on early 386/486 CPUs. (Almost certainly no longer relevant in any case.)

(2)  tclWinChan.c (Tcl_MakeFileChannel) - This one is weird, but appears to come up on WinNT and Win2k only. On those systems, if certain channel handles are duplicated, the DuplicateHandle function will succeed, but closing the duplicated handle will throw EXCEPTION_INVALID_HANDLE.  This is almost certainly a bug in a Windows device driver somewhere. I'll be happy to put in protective logic on Win64 in this spot if someone can come up with a test case that fails on some machine, somewhere.

(3) tclWinFCmd.c (DoRenameFile): On Windows NT/2k (and not on more recent versions nor on Windows CE), an attempt to rename a serial port gets a null pointer exception down inside kernel32.dll. This code is definitely a workaround for an operating system bug that was fixed years ago.

(4) tclWinFCmd.c (TclpObjDoCopyFIle): The same error, only with copying a serial port. Once again, it's an operating system bug that was fixed years ago.

So in short, all of these things appear to be in places that aren't relevant for 64-bit versions of Windows. I'll certainly bump the priority for a failing test case, but it's hard to justify the complexity of the assembly code solution if it's just to provide workarounds for operating system bugs that were fixed years ago.
dgpplain2010-09-08 21:26:09
see 3059922
dgpplain2010-09-08 22:49:44
allow_comments - 1
nijtmansplain2010-12-13 16:29:40
Just found out that TkFinalize sometimes crashes on Win64 (compiled with mingw-w64). The cause is that here still SEH emulation was active, but it only saves and restores 32-bit pointers in stead of 64-bit. So I modified Kai's patch (Thanks!!!!) to protect the TkFinalize call in stead of the Win32-specific code.

This is an example (IMHO) where the assembler code is not meant o protect
from an OS bug, but to protect finalizing Tk when the application went in an invalid state. That's unfortunate, but a good excuse to keep it in.

Thanks, Kai. Your patch was a great help in understanding what was going on here.
nijtmansplain2010-12-13 16:29:41
allow_comments - 0
Log in (anonymous is fine) to add a comment.

Attachments: