Runtime linker too eagerly checks for symbol names
I discovered this bug in https://github.com/haskell-foundation/foundation/issues/326. Take this file:
module Main (main) where
foreign import ccall "notAThing"
notAThing :: IO ()
main :: IO ()
main = putStrLn "Hello, World!"
Compiling and running this file works without issue. But if you try to use the runtime linker, things go haywire:
$ C:\Users\RyanGlScott\Software\ghc\inplace\bin\runghc Bug.hs
ghc-stage2.exe: ^^ Could not load 'notAThing', dependency unresolved. See top entry above.
Bug.hs:
ByteCodeLink: can't find label
During interactive linking, GHCi couldn't find the following symbol:
notAThing
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@haskell.org
This isn't just limited to Windows, since the same thing happens on Linux.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Runtime System (Linker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | Phyx- |
Operating system | |
Architecture |