[GHC] #12186: GHC compiled executable incompatible with 3rd party software

GHC ghc-devs at haskell.org
Sat Jun 11 04:54:27 UTC 2016


#12186: GHC compiled executable incompatible with 3rd party software
-------------------------------------+-------------------------------------
           Reporter:  tim-m89        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
  (Linking)                          |
           Keywords:                 |  Operating System:  Windows
       Architecture:  x86_64         |   Type of failure:  Incorrect result
  (amd64)                            |  at runtime
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I've been trying to work on a library that allows Haskell to call into
 .Net code, but there's a major show stopper in that the .Net runtime
 starting with version 4.0, doesn't like the executable files that GHC
 produces.

 I've managed to reduce a test case to not actually depend on using
 Haskell, but just using GHC to compile a C file, and that C file being
 nothing but a dumb wrapper around a small dll. The resulting executable
 exhibits the incorrect behaviour:
 {{{
 > stack exec ghc -- main.c -no-hs-main
 > main
 1
 2
 3
 4
 5
 6
 ICLRRuntimeHost Start failed w/hr 0x80004005
 }}}

 Then I can also use GCC on the intermediate object file that was created,
 and produce an executable that exhibits the correct behaviour:

 {{{
 > stack exec gcc -- main.o -o main2.exe
 > main2
 1
 2
 3
 4
 5
 6
 7
 8
 }}}

 I've put a copy of the test case here:
 https://gitlab.com/tim-m89/DotNetHostingTest

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12186>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list