[LLVMdev] ExecutionEngine always comes back NULL

Óscar Fuentes ofv at wanadoo.es
Wed Jan 9 09:09:36 PST 2013


Rick Mann <rmann at latencyzero.com> writes:

> On Jan 8, 2013, at 13:55 , "Kaylor, Andrew" <andrew.kaylor at intel.com> wrote:
>
>> You need to include 'llvm/ExecutionEngine/JIT.h' (or
>> llvm/ExecutionEngine/JIT.h' if you want that engine) from your main
>> file. Including that file forces the JIT static constructor to be
>> linked into your executable. Without it, the JIT static constructor
>> gets optimized out and you get the result you're seeing.
>
> Wow, how obscure! Thank you; I never would've figured that out.
>
> Why is it done that way? That seems…quite horrible, actually. Why not
> just instantiate the JIT on demand as part of instantiating the
> Engine?

I guess that instantiating the JIT on that way would force the clients
to link with that feature (which exists only on selected platforms.) If
the user wants the interpreter, why should he be forced to include the
JIT on the final executable? And vice-versa: if you are interested only
on the JIT, why should your executable carry the weight of the
interpreter?




More information about the llvm-dev mailing list