I am trying to JIT some code containing an indirect branch (and the
corresponding store i8* blockaddress(@label)). I am using LLVM 2.7
code base. I build the ExecutionEngine using EngineBuilder, and call
engine->getPointerToFunction(func). When I use
setOptLevel(llvm::CodeGenOpt::None), the JITing fails with the
following message :
JIT.h:131: virtual void*
llvm::JIT::getPointerToBasicBlock(llvm::BasicBlock*): Assertion `0 &&
"JIT does not support address-of-label yet!"' failed.
However, when I use setOptLevel(llvm::CodeGenOpt::Less) or higher
(Default, Aggressive), the assertion does not happen. However, when I
disassemble the JITed program, I see that the label getting stored is
wrong, it is not in the range of the function's code space. I am
wondering whether I am doing something wrong. Does the JIT mode not
support indirect branches?