[llvm-dev] Static constructors with ORC JIT?

Alex Denisov via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 15 05:07:07 PDT 2019


Hi Daniele,

The easiest way is to collect the constructors from the modules and then execute them manually as you would with any other function.
The simplest solution is to take this code and modify it to get the list of constructor functions:
https://github.com/llvm-mirror/llvm/blob/1154d31e8c429e53307d3fc0edd13d9b261c26dc/lib/ExecutionEngine/ExecutionEngine.cpp#L370

This might be not the most ideal solution, but it works.

Cheers,
Alex.

> On 14. Mar 2019, at 22:15, Daniele Vettorel via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi all,
> 
> Is there way to tell the ORC JIT infrastructure to run the static constructors in a module that has just been compiled? I see that the ExecutionEngine class has a 
> runStaticConstructorsDestructors 
> function, is that relevant with ORC and if so, how should it be accessed? Thanks, Daniele
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list