Until the GHCi linker is made capable of handling .ctors sections in
  PEi object files, stick with __stginits. Being a bit sloppy by
  using 'mingw32_HOST_OS' to test for this.

The ctors don't really need to be called for modules loaded into GHCi (ghci makes no effort to call stginit in those modules, either). All we need to do is make the linker ignore them, as it does for other platforms.


It also seems to choke on ".rdata" sections, which it expects to be called ".rodata" instead.

Below is an _untested_ patch (I don't build GHC on my windows box) that should allow the Linker to ignore .ctors and recognize .rdata in PEi object files.

Cheers,

Wolfgang


Index: Linker.c =================================================================== RCS file: /home/cvs/root/fptools/ghc/rts/Linker.c,v retrieving revision 1.190 diff -u -r1.190 Linker.c --- Linker.c 22 Apr 2005 17:00:48 -0000 1.190 +++ Linker.c 23 Apr 2005 05:07:07 -0000 @@ -1963,7 +1964,8 @@ # endif

if (0==strcmp(".text",sectab_i->Name) ||
- 0==strcmp(".rodata",sectab_i->Name))
+ 0==strcmp(".rodata",sectab_i->Name) ||
+ 0==strcmp(".rdata",sectab_i->Name))
kind = SECTIONKIND_CODE_OR_RODATA;
if (0==strcmp(".data",sectab_i->Name) ||
0==strcmp(".bss",sectab_i->Name))
@@ -1981,6 +1983,8 @@
information. */
&& 0 != strcmp(".stab", sectab_i->Name)
&& 0 != strcmp(".stabstr", sectab_i->Name)
+ /* ignore constructor section for now */
+ && 0 != strcmp(".ctors", sectab_i->Name)
) {
errorBelch("Unknown PEi386 section name `%s' (while processing: %s)", sectab_i->Name, oc->fileName);
return 0;


_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to