如何使llvm jit在MSVC ++中工作 [英] How to make llvm jit work in MSVC++

查看:161
本文介绍了如何使llvm jit在MSVC ++中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来LLVM中的万花筒示例已被破坏,至少在MSVC ++ x64中已经破坏了相当长的一段时间,甚至几个月.由于相同的原因,它在MCJIT及其新的Orc JIT框架中不起作用.

It appears that Kaleidoscope example in LLVM has been broken, at least in MSVC++ x64 for a quite while, maybe several months. It doesn't work in MCJIT and in their new Orc JIT framework for a same reason.

// Get the address of the JIT'd function in memory.
auto ExprSymbol = J.findUnmangledSymbol("__anon_expr");

此表达式返回空值,并导致空指针错误.我现在无法猜测如何解决,因为调用树在那里太深了,可能需要大约几天的调试时间.但从理论上讲,此代码具有教育意义,不会给新手带来麻烦.所以也许我做错了事.

This expression returns null and cause null pointer error as a result. I can't guess how to make workaround at this moment because call tree is too deep there and may require ~few days of debugging. But in theory, this code is educational and shouldn't cause trouble for newcomers. So maybe i'm doing something wrong.

推荐答案

llvm邮件列表中的Lang Hames能够回答此问题.看来方法COFFObjectFile :: getSymbolFlags根本没有启用SF_Export标志,因此使所有创建的符号对于Windows平台中的万花筒的findSymbol方法都不可见.虽然可以访问未导出的符号,所以可以采取某种解决方法.

Lang Hames from the llvm mailing list was able to answer this question. It appears that method COFFObjectFile::getSymbolFlags doesn't enable SF_Export flag at all, thus making all created symbols invisible for the Kaleidoscope's findSymbol method in the Windows platform. It is possible to get access to non-exported symbols though, so some kind of workaround is possible.

这篇关于如何使llvm jit在MSVC ++中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆