Hi, Am 21.05.13 21:57, schrieb Kaylor, Andrew:> Yeah, this is a problem with the static constructor getting optimized out. Including "JIT.h" is supposed to fix that. > Is it possible that the file where you are including "JIT.h" doesn't have any required code in it?I'm including "JIT.h" directly in the main module, which also uses the engine. See the small test case attached. Even if I bypass the dummy object and call LLVMLinkInJIT() directly, it still gets optimized out... ciao, Mario -------------- next part -------------- /* * vim: set tabstop=4 shiftwidth=4 expandtab: */ #define DEBUG_TYPE "ExecutionEngineTest" #include <llvm/ExecutionEngine/Interpreter.h> #include <llvm/ExecutionEngine/JIT.h> #include <llvm/Support/TargetSelect.h> #include <llvm/LLVMContext.h> #include <llvm/Module.h> #include <cassert> using namespace llvm; int main(void) { InitializeNativeTarget(); #if 1 LLVMLinkInJIT(); #endif EngineBuilder engineBuilder(new Module("foo", getGlobalContext())); #if 0 engineBuilder.setEngineKind(EngineKind::Interpreter); #else engineBuilder.setEngineKind(EngineKind::JIT); #endif const OwningPtr<ExecutionEngine> executionEngine(engineBuilder.create()); assert(executionEngine && "Failed to create execution engine"); return 0; }
If you send me details about how you're building this I'll look into it. -Andy -----Original Message----- From: Mario Schwalbe [mailto:mario at se.inf.tu-dresden.de] Sent: Wednesday, May 22, 2013 2:34 AM To: Kaylor, Andrew Cc: Mario Schwalbe; LLVM Devel Subject: Re: [LLVMdev] Static linking of execution engine Hi, Am 21.05.13 21:57, schrieb Kaylor, Andrew:> Yeah, this is a problem with the static constructor getting optimized out. Including "JIT.h" is supposed to fix that. > Is it possible that the file where you are including "JIT.h" doesn't have any required code in it?I'm including "JIT.h" directly in the main module, which also uses the engine. See the small test case attached. Even if I bypass the dummy object and call LLVMLinkInJIT() directly, it still gets optimized out... ciao, Mario
Am 22.05.13 19:32, schrieb Kaylor, Andrew:> If you send me details about how you're building this I'll look into it.Thanks. I forgot to mention it's LLVM 3.2 on Ubuntu 12.10. The command line is: $ g++-4.7 ExecutionEngineTest.cpp $(llvm-config --cxxflags --ldflags --libs) -lpthread -ldl $ g++-4.7 -static ExecutionEngineTest.cpp $(llvm-config --cxxflags --ldflags --libs) -lpthread -ldl The -lpthread -ldl is there explicitly because llvm-config prints them as part of --ldflags before the dependent LLVM libs. The first of the above commands works well. The second one does not. ciao, Mario