[LLVMdev] ExecutionEngine fails to use MCJIT, non-unique static member variables
ml at dadommas.de
ml at dadommas.de
Mon Jul 9 09:19:03 PDT 2012
I see very strange behaviour. I am linking to LLVMMCJIT and I #include
MCJIT.h. I can see in the debugger that MCJIT::Register is being called.
If I break in ExecutionEngine::create, I
can see that UseMCJIT is true and ExecutionEngine::MCJITCtor is
non-zero. Still at this point (lines after 481):
if (UseMCJIT && ExecutionEngine::MCJITCtor) {
ExecutionEngine *EE =
ExecutionEngine::MCJITCtor(M, ErrorStr, JMM,
AllocateGVsWithCode, TheTM.take());
if (EE) return EE;
} else if (ExecutionEngine::JITCtor) {
ExecutionEngine *EE =
ExecutionEngine::JITCtor(M, ErrorStr, JMM,
AllocateGVsWithCode, TheTM.take());
if (EE) return EE;
}
The second if-branch is being executed, i.e. ExecutionEngine::JITCtor is
being called.
I can see in gdb that the breakpoint in EngineBuilder::create is present
at two different addresses, I can also see that
ExecutionEngine::MCJITCtor is present twice in memory.
&ExecutionEngine::MCJITCtor in MCJIT::Register: 0x9bfff0
&ExecutionEngine::MCJITCtor in ExecutionEngine::create: 0x7ffff7bd4390
Is this a linking issue?
For more info, here the linking command:
g++ -Wl,-O1 -o qling main.o widget.o util.o consoleoutput.o codeinput.o
codewidget.o moc_widget.o moc_consoleoutput.o moc_codeinput.o
moc_codewidget.o -L/usr/lib64/qt4 -
L/home/thomas/opt/llvm-debug/lib -lm -ldl -fPIC -rdynamic
qt-hack/qatomic_sun.o -lcling -lclingInterpreter -lclingUtils
-lclangFrontend -lclangFrontendTool -lclangSerialization -
lclangDriver -lclangCodeGen -lclangParse -lclangSema -lclangEdit
-lclangAnalysis -lclangRewrite -lclangAST -lclangLex -lclangBasic
-lLLVMTableGen -lLLVMMCJIT -
lLLVMRuntimeDyld -lLLVMObject -lLLVMMCDisassembler -lLLVMLinker
-lLLVMipo -lLLVMInterpreter -lLLVMInstrumentation -lLLVMJIT
-lLLVMExecutionEngine -lLLVMDebugInfo -
lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen
-lLLVMX86Desc -lLLVMSelectionDAG -lLLVMX86AsmPrinter -lLLVMX86Utils
-lLLVMX86Info -
lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts
-lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAsmParser
-lLLVMArchive -lLLVMBitReader -
lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport -lQtGui
-L/usr/lib64 -L/usr/lib64/qt4 -L/usr/X11R6/lib -lQtCore -lgthread-2.0
-lrt -lglib-2.0 -lpthread
Any help is appreciated,
Thomas
More information about the llvm-dev
mailing list