search for: takemodule

Displaying 6 results from an estimated 6 matches for "takemodule".

2019 Sep 19
3
"corrupted size vs. prev_size" when calling ExecutionSession::lookup()
...nerate IR code . if (llvm::verifyModule(*AST::getModule(), &llvm::errs())) { return 0; } else { std::cout << "Verified success\n"; } // run the generated IR code llvm::cantFail(CompileLayer.add(ES.getMainJITDylib(), llvm::orc::ThreadSafeModule(std::move(AST::takeModule()), AST::takeContext()))); auto symbol = llvm::cantFail(ES.lookup({&ES.getMainJITDylib()}, Mangle("main"))); int (*entry)() = (decltype(entry)) symbol.getAddress(); std::cout << entry() << std::endl; and the "corrupted size vs. prev_size" will happen i...
2013 Feb 21
0
[LLVMdev] Missing common linkage
...ine CompileBitcodeAction(Module*& dstModule, LLVMContext* const context = NULL) : clang::EmitLLVMOnlyAction(context), dstModule(dstModule) {} protected: virtual inline void EndSourceFileAction() { clang::EmitLLVMOnlyAction::EndSourceFileAction(); dstModule = takeModule(); } }; Module* module = NULL; ToolInvocation tool(cmdLine, new CompileBitcodeAction(module, context), fileManager); The command line is set up for C (-x c). I use different ToolInvocation instances and LLVM contexts to compile multiple modules sequentially. This works fine with LLVM/CLANG 3...
2010 Aug 18
1
[LLVMdev] clang: call extern function using JIT
...ilerInvocation::GetResourcesPath(argv[0], MainAddr); // Create and execute the frontend to generate an LLVM bitcode module. llvm::OwningPtr<CodeGenAction> Act(new EmitLLVMOnlyAction()); if (!Clang.ExecuteAction(*Act)) return 1; int Res = 255; if (llvm::Module *Module = Act->takeModule()) { Res = Execute(Module, envp); } // Shutdown. llvm::llvm_shutdown(); return Res; } gafferuk wrote: > > I tried what you said, now I get: > > LLVM ERROR: Program used external function 'yipee' which could not be > reso...
2010 Aug 18
0
[LLVMdev] clang: call extern function using JIT
I tried what you said, now I get: LLVM ERROR: Program used external function 'yipee' which could not be resolved! Stack dump: 0. Running pass 'X86 Machine Code Emitter' on function '@main' did not even get as far as a breakpoint. Óscar Fuentes wrote: > > gafferuk <gafferuk at gmail.com> writes: > >> Im confused. The function i wish to call is
2010 Aug 18
2
[LLVMdev] clang: call extern function using JIT
gafferuk <gafferuk at gmail.com> writes: > Im confused. The function i wish to call is a return type of int. > Im calling it with int dd = yipee(1); > > What's wrong? Declare the function: int yipee(int); int main() { int dd = yipee(1); return 0; } If that still crashes, put a breakpoint on `yipee' and see if the execution gets there, if the argument is
2013 Oct 03
0
[LLVMdev] libclang JIT frontend
...CompilerInvocation::GetResourcesPath(argv[0], MainAddr); // Create and execute the frontend to generate an LLVM bitcode module. OwningPtr<CodeGenAction> Act(new EmitLLVMOnlyAction()); if (!Clang.ExecuteAction(*Act)) return 1; int Res = 255; if (llvm::Module *Module = Act->takeModule()) Res = Execute(Module, envp); llvm::errs() << "Result = " << Res << "\n"; //Not an error, but just report Res to see what happened. // Shutdown. llvm::llvm_shutdown(); return Res; } //int main(int argc, const char **argv, char * const *envp)...