[LLVMdev] printd ( me, again )
Lang Hames
lhames at gmail.com
Fri Apr 10 13:42:08 PDT 2015
Hi Manoel,
The following patch works for me. What platform are you running on?
- Lang.
On Fri, Apr 10, 2015 at 10:54 AM, Manoel Teixeira <mbsteixeira at gmail.com>
wrote:
>
> Hi, Lang.
>
> I'm trying to solve the problem alone, but I'm failling.
>
> See this test , using your orc example:
> ready> extern printd(x)
> printd(4);
> ready> Expression function:
> ; ModuleID = 'jit_module_1'
> target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
>
> define double @__anon_expr() {
> entry:
> %calltmp = call double @printd(double 4.000000e+00)
> ret double %calltmp
> }
>
> declare double @printd(double)
> LLVM ERROR: Unknown section in relocation
>
> I've provided the passes you told me :
> ExternalSymbols[Mangle("printd")] = (uint64_t)&printd;
> auto Resolver = createLambdaResolver(
> [&](const std::string &Name) {
>
> /// Try the JIT first....
> if (auto Sym = findSymbol(Name))
> return RuntimeDyld::SymbolInfo(Sym.getAddress(),
> Sym.getFlags());
>
> // Try the external symbols map...
> if (auto Addr = ExternalSymbols.lookup(Name))
> return RuntimeDyld::SymbolInfo(Addr,
>
> JITSymbolFlags::Exported);
>
> // Symbol not found.
> return RuntimeDyld::SymbolInfo(nullptr);
> },
> [](const std::string &S) { return nullptr; }
> );
>
> if I use only a simple expression, it runs ok.
> ready> 4;
> Expression function:
> ; ModuleID = 'jit_module_1'
> target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
>
> define double @__anon_expr() {
> entry:
> ret double 4.000000e+00
> }
> Evaluated to 4.000000
>
> The lambda function was not called any time. Is there any aditional step
> to make it be called?
>
> Cheers,
> Manoel.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150410/2ca028fe/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: orc_initial_external_resolution.patch
Type: application/octet-stream
Size: 1523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150410/2ca028fe/attachment.obj>
More information about the llvm-dev
mailing list