checkProddableBlock: invalid fixup in runtime linker (Windows)
I attempted to load a very simple C file into GHC using the linker and got this error. The C file is:
#include <stdio.h>
static void f(void); // __attribute__((constructor));
static void f(void)
{
printf("Hooray!");
}
and the test program:
{-# LANGUAGE ForeignFunctionInterface #-}
import Foreign.C.String
main = do
initLinker
withCWString "test.o" $ \s -> loadObj s
resolveObjs
foreign import ccall "initLinker" initLinker :: IO ()
foreign import ccall "loadObj" loadObj :: CWString -> IO Int
foreign import ccall "resolveObjs" resolveObjs :: IO ()
Test is run as:
bash.exe-3.1$ gcc -c test.c
bash.exe-3.1$ ../ghc-init/inplace/bin/ghc-stage2 --make foo.hs -debug -fforce-recomp
[1 of 1] Compiling Main ( foo.hs, foo.o )
Linking foo.exe ...
bash.exe-3.1$ ./foo
foo.exe: Unknown PEi386 section name `.eh_frame' (while processing: test.o)
foo.exe: internal error: checkProddableBlock: invalid fixup in runtime linker: 002c0154
(GHC version 7.7.20130905 for i386_unknown_mingw32)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
More useful info:
bash.exe-3.1$ objdump -s -j .text test.o
test.o: file format pe-i386
Contents of section .text:
0000 5589e583 ec18c704 24000000 00e80000 U.......$.......
0010 0000c9c3 ....
bash.exe-3.1$ objdump -r -j .text test.o
test.o: file format pe-i386
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
00000009 dir32 .rdata
0000000e DISP32 _printf
Trac metadata
Trac field | Value |
---|---|
Version | 7.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Runtime System |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |