Daniele Vettorel via llvm-dev
2019-Mar-14 21:15 UTC
[llvm-dev] Static constructors with ORC JIT?
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190314/2775cb9f/attachment.html>
Alex Denisov via llvm-dev
2019-Mar-15 12:07 UTC
[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: 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
Daniele Vettorel via llvm-dev
2019-Mar-15 16:59 UTC
[llvm-dev] Static constructors with ORC JIT?
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. Cheers, Daniele ________________________________________ 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: 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
Reasonably Related Threads
- Static constructors with ORC JIT?
- runStaticConstructorsDestructors() causes crash on exit
- runStaticConstructorsDestructors() causes crash on exit
- runStaticConstructorsDestructors() causes crash on exit
- runStaticConstructorsDestructors() causes crash on exit