llvm-hs-examples icon indicating copy to clipboard operation
llvm-hs-examples copied to clipboard

fixed orc example, fixed part of arith example

Open LlinksRechts opened this issue 3 years ago • 1 comments

This PR fixes parts of #13

I ran across the same problem when trying to run the ORC and Arith examples, so I took a deep dive into LLVM and found out the following:

ORC

This example was simply missing the registration of the module, ie. the call to withModule. Therefore, the add symbol could not be found (that llvm-hs simply returns a JITSymbolError "" without any message is a bug imo, I'm going to report that right after).

Arith

In this example, the symbol resolver was not registered and added to the resolver map. Therefore, an error was thrown in the call to withModule, which needs a resolver. However, this example still does not work (can't find the symbol); the problem lies somewhere in the module definition (I tried executing the module with the eagerJit function from ORC, and that didn't work either); I haven't been able to look into that more.

LlinksRechts avatar Jun 01 '21 20:06 LlinksRechts

After some research I found that it is able to find the f symbol, but can't find sin. I haven't really looked into what arith actually does, so I haven't put too much more time into that. EDIT: This is because the llvm libraries (in fact, no external libraries) are not linked, so llvm.sin.f64 is not available. I have yet to find out how to get it to link these in.

LlinksRechts avatar Jun 03 '21 11:06 LlinksRechts