This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] HEAD build fails on cygwin (probably also mingw) in tcl/win subdir



      Hi all,

  CVS insight doesn't currently build on cygwin: it comes to a halt building
the target tcl lib, with the following errors when it comes to do the final
link:

----------------------snip----------------------
Creating library file: libtcl84.a
tclWin32Dll.o: In function `TclpCheckStackSpace':
/repository/tools/temp/src/tcl/win/tclWin32Dll.c:364: undefined reference to
`__except_checkstackspace_handler'
tclWinChan.o: In function `Tcl_MakeFileChannel':
/repository/tools/temp/src/tcl/win/tclWinChan.c:1056: undefined reference to
`__except_makefilechannel_handler'
tclWinFCmd.o: In function `DoCopyFile':
/repository/tools/temp/src/tcl/win/tclWinFCmd.c:558: undefined reference to
`__except_docopyfile_handler'
tclWinFCmd.o: In function `TclpObjRenameFile':
/repository/tools/temp/src/tcl/win/tclWinFCmd.c:204: undefined reference to
`__except_dorenamefile_handler'
collect2: ld returned 1 exit status
make[2]: *** [tcl84.dll] Error 1
make[2]: Leaving directory `/repository/tools/temp/obj/tcl/win'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/repository/tools/temp/obj/tcl'
make: *** [all-tcl] Error 2
----------------------snip----------------------

  The reason these functions are seemingly undefined is that, despite being
present in the source, they are all declared static, and only referenced
from within an inline asm statement.  This never used to cause any problem,
but cygwin has recently moved from gcc-3.3.x to gcc-3.4.x series, and the
optimisers must have gotten a bit cleverer.  The code in tclWinFCmd attempts
to spoof out the compiler by placing a recursive call to
_except_dorenamefile_handler inside _except_dorenamefile_handler; these
days, that successfully suppresses the 'function defined but not referenced'
warning, but isn't enough to fool the compiler into emitting the function
any more.

  Anyway, since the source code already uses unprotected __attribute__s in
that area, I figured it was ok to use '__attribute__ ((used))'.  Other
solutions could have included making the function reference visible to the
compiler, either by inserting a fake call, or by taking the address of it to
pass in to the inline asm, or making it extern rather than static, but this
looks like a reasonable and minimally-intrusive change to me.

  BTW, is the tcl dll supposed to be multithread safe?  The use of static
variables to store ESP/EBP before the exception and reload them afterward
looks, on the face of it, like it would have to be a problem, but it could
be that these are lowlevel functions that are only ever called from within
higher-level APIs that do suitable locking; I don't know, does anyone else?



2005-07-27  Dave Korn  <dave.korn@artimi.com>

tcl/

	* win/tclWin32Dll.c (ESP, EBP, _except_checkstackspace_handler): Add
  'used' attribute to prevent optimisation from discarding.
	* win/tclWinChan.c (ESP, EBP, _except_makefilechannel_handler):
  Likewise.
	* win/tclWinFCmd.c ( _except_dorenamefile_handler): Likewise.


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....

Attachment: cyg-tcl-sehfix.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]