1

I'm using stack. When i pass -keep-llvm-files to GHC, i get Main.ll, Lib.ll, and Paths_projectname.ll. How would i use these to create an executable using llvm commands such as llvm-link, llc, and llvm-as as opposed to just letting stack do it for me? Also do i need Paths_projectname.ll create an executable for the program expressed in Main.hs and Lib.hs or is it just purely related to calling projectname-exe from stack?

So far I've tried converting Main.ll, Lib.ll, and Paths_projectname.ll to llvm bitcode using llvm-as. Then i linked them with llvm-link. I tried with and without Paths_projectname.bc. Then i converted the output of llvm-link to an object file with llc. But at the end both clang and gcc fail to compile it to an executable.

duplode
  • 33,731
  • 7
  • 79
  • 150
Anon
  • 375
  • 1
  • 7
  • 1
    I suspect that `stack` has a verbosity level at which it will show you the exact llvm commands it is running. e.g. with `cabal`, [passing `-v3` should do so](https://stackoverflow.com/q/67726813/791604). – Daniel Wagner Oct 25 '21 at 20:51
  • 1
    There's some information in [this answer](https://stackoverflow.com/a/46475029/7203016) that might be helpful. – K. A. Buhr Oct 26 '21 at 00:38

0 Answers0