[llvm-dev] Static constructors with ORC JIT?

Daniele Vettorel via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 15 09:59:43 PDT 2019

Thank you Alex,

I went and implemented a solution along those lines. It works well.

It may be worth mentioning static constructors in the Kaleidoscope tutorial.

From: Alex Denisov [1101.debian at gmail.com]
Sent: 15 March 2019 08:07
To: Daniele Vettorel
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] Static constructors with ORC JIT?

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:

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


> 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