Brian Picciano via llvm-dev
2016-Jun-28 23:32 UTC
[llvm-dev] Noob: need help with go bindings
I have the following code to generate a really basic IR: http://gobin.io/LtdJ And the output I get from it is: http://gobin.io/XgkH That IR code which is dumped seems to work fine if I do llc then gcc on it, so I'm not sure why it won't work through the engine. This is my first time using LLVM so I'm pretty new with all of it, any help would be greatly appreciated. Thanks! - Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160628/13e7a116/attachment.html>
Andrew Wilkins via llvm-dev
2016-Jun-29 07:35 UTC
[llvm-dev] Noob: need help with go bindings
On Wed, 29 Jun 2016 at 00:32 Brian Picciano via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I have the following code to generate a really basic IR: > http://gobin.io/LtdJ > > And the output I get from it is: http://gobin.io/XgkH > > That IR code which is dumped seems to work fine if I do llc then gcc on > it, so I'm not sure why it won't work through the engine. This is my first > time using LLVM so I'm pretty new with all of it, any help would be greatly > appreciated. Thanks! >Hi Brian, The issue here is that "NewExecutionEngine" will create either an MCJIT- or an interpreter-based execution engine, and only the former will be able to resolve symbols in the parent process. MCJIT will only be used if you have called the appropriate initialisation functions first. If you add the following to the top of your main() function, it should work: LinkInMCJIT() InitializeNativeTarget() InitializeNativeAsmPrinter() Cheers, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160629/625d09fd/attachment.html>
Brian Picciano via llvm-dev
2016-Jun-30 00:52 UTC
[llvm-dev] Noob: need help with go bindings
That did it, thanks for the help! For the future is there a set of documentation for these bindings, or their equivalent c functions? I tried looking but was having trouble finding anything that seemed to match. On Wed, Jun 29, 2016 at 1:35 AM Andrew Wilkins <axwalk at gmail.com> wrote:> On Wed, 29 Jun 2016 at 00:32 Brian Picciano via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> I have the following code to generate a really basic IR: >> http://gobin.io/LtdJ >> >> And the output I get from it is: http://gobin.io/XgkH >> >> That IR code which is dumped seems to work fine if I do llc then gcc on >> it, so I'm not sure why it won't work through the engine. This is my first >> time using LLVM so I'm pretty new with all of it, any help would be greatly >> appreciated. Thanks! >> > > Hi Brian, > > The issue here is that "NewExecutionEngine" will create either an MCJIT- > or an interpreter-based execution engine, and only the former will be able > to resolve symbols in the parent process. MCJIT will only be used if you > have called the appropriate initialisation functions first. If you add the > following to the top of your main() function, it should work: > > LinkInMCJIT() InitializeNativeTarget() InitializeNativeAsmPrinter() > > Cheers, > Andrew >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160630/bfe9255d/attachment.html>