I'm trying to run LLVM bitcode generated from Haskell source code instead of compiling the code to a native binary on macOS.
I have following file:
$ cat hello_world.hs
main =
putStrLn "Hello world!"
And I'm using following steps to create the .bc
file:
$ brew install stack
$ brew install llvm@6
$ stack ghc -- -keep-llvm-files hello_world.hs
$ clang -c -emit-llvm hello_world.ll -o hello_world.bc
When I now try to run it, I get following error:
$ lli hello_world.bc
'main' function not found in module.
When I set -fllvm
to compile to a native binary via LLVM it all works, so it doesn't seem to be a problem with my LLVM setup.
How can this be fixed?