[GHC] #12846: On Windows, runtime linker can't find function defined in GHC's RTS

GHC ghc-devs at haskell.org
Thu Nov 17 01:29:58 UTC 2016


#12846: On Windows, runtime linker can't find function defined in GHC's RTS
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Runtime        |           Version:  8.0.1
  System (Linker)                    |
           Keywords:                 |  Operating System:  Windows
       Architecture:                 |   Type of failure:  GHC rejects
  Unknown/Multiple                   |  valid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This is an annoyance I discovered when working with the
 [https://github.com/rrnewton/haskell-
 lockfree/tree/0ea12fc141c6bd4762773a1adc2f005de068369c/atomic-primops
 atomic-primops] package on Windows. Here is a simplified test case:

 {{{#!hs
 module Main (main) where

 foreign import ccall unsafe "store_load_barrier"
   storeLoadBarrier :: IO ()

 main :: IO ()
 main = do
   putStrLn "1"
   storeLoadBarrier
   putStrLn "2"
 }}}

 Compiling and running this program works without issue. But when run as
 GHCi bytecode, it fails. I've reproduced this with GHC 8.0.1 and HEAD (but
 based on [https://github.com/rrnewton/haskell-lockfree/pull/38 this], the
 issue is likely much older than 8.0.1).

 {{{
 $ runghc Bug.hs
 Bug.hs:
 ByteCodeLink: can't find label
 During interactive linking, GHCi couldn't find the following symbol:
   store_load_barrier
 This may be due to you not asking GHCi to load extra object files,
 archives or DLLs needed by your current session.  Restart GHCi, specifying
 the missing library using the -L/path/to/object/dir and -lmissinglibname
 flags, or simply by naming the relevant files on the GHCi command line.
 Alternatively, this link failure might indicate a bug in GHCi.
 If you suspect the latter, please send a bug report to:
   glasgow-haskell-bugs at haskell.org
 }}}

 To work around this issue, `atomic-primops` currently links against
 [https://github.com/rrnewton/haskell-
 lockfree/blob/0ea12fc141c6bd4762773a1adc2f005de068369c/atomic-
 primops/cbits/RtsDup.c#L52-L69 a separate C file] that contains an exact
 duplicate of the `store_load_barrier` function from GHC's RTS when build
 on Windows.

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


More information about the ghc-tickets mailing list