<div>I found the following problem when I try to debug "target does not support mc emission" in linux (the same code executes OK in windows):</div><div><br></div>Below is a snippet extracted from this method,<div>
<br></div><div><div>if (UseMCJIT && ExecutionEngine::MCJITCtor) {</div><div> ExecutionEngine *EE =</div><div> ExecutionEngine::MCJITCtor(M, ErrorStr, JMM, OptLevel,</div><div> AllocateGVsWithCode, TM);</div>
<div> if (EE) return EE;</div><div> } else if (ExecutionEngine::JITCtor) {</div><div> ExecutionEngine *EE =</div><div> ExecutionEngine::JITCtor(M, ErrorStr, JMM, OptLevel,</div><div> AllocateGVsWithCode, TM);</div>
<div> if (EE) return EE;</div><div> }</div><div><br></div><div>Both ExecutionEngine::MCJITCtor and ExecutionEngine::JITCtor are function pointers (static members in class ExecutionEngine) and are initialized at the very beginning of ExecutionEngine.cpp to be 0 (NULL): </div>
<div><br></div><div><div>ExecutionEngine *(*ExecutionEngine::JITCtor)(</div><div> Module *M,</div><div> std::string *ErrorStr,</div><div> JITMemoryManager *JMM,</div><div> CodeGenOpt::Level OptLevel,</div><div> bool GVsWithCode,</div>
<div> TargetMachine *TM) = 0;</div><div>ExecutionEngine *(*ExecutionEngine::MCJITCtor)(</div><div> Module *M,</div><div> std::string *ErrorStr,</div><div> JITMemoryManager *JMM,</div><div> CodeGenOpt::Level OptLevel,</div>
<div> bool GVsWithCode,</div><div> TargetMachine *TM) = 0;</div></div><div><br></div><div><br></div><div>When I create the engine, I set UseMCJIT to "true" using </div><div>engineBuilder.setUseMCJIT(true);</div>
<div><br></div><div>Then I call </div><div>engineBuilder.crate()</div><div>to create the Execution engine.</div><div><br></div><div>In windows and Linux (Ubuntu), I got a different execution path when it reaches the if/else structure mentioned in the very beginning of this email:</div>
<div>Windows: it goes into the "else if" branch, which means that ExecutionEngine::MCJITCtor is evaluated as 0/NULL. It then uses ExecutionEngine::JITCtor to create the engine and successful. However, this is not what I meant to do.</div>
<div>Linux: it goes into the "if" branch, which means ExecutionEngine::MCJITCtor is not 0/NULL, and it must have been assigned a value somewhere. Then it uses ExecutionEngine::MCJITCtor (which is what I meant to do) but fails, giving me an error "target does not support mc emission"</div>
<div><br></div><div>In Windows, I am linking all the libraries (.lib) statically; In Linux, I am dynamic linking <a href="http://libLLVM3.0.so">libLLVM3.0.so</a></div><div><br></div><div>Question:</div><div>1. Where and when do ExecutionEngine::MCJITCtor and ExecutionEngine::JITCtor get assigned a different value other than 0/NULL?</div>
<div>2. Why the value of ExecutionEngine::MCJITCtor are different in Windows and Linux?</div><div><br></div><div>Thanks.</div><div><div><br></div>-- <br>Xinglin Zhang<br><br>
</div></div>