[PATCH] D16188: LLVMRunStaticConstructors can be called before object is finalized, #24028

David Herberth via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 08:46:06 PST 2016


Dav1d added a comment.

In http://reviews.llvm.org/D16188#326917, @deadalnix wrote:

> What happen if the EE object is finalized several times ?


Good question it doesn't explicitly state that you can call it more than once.

> http://llvm.org/docs/doxygen/html/classllvm_1_1ExecutionEngine.html#ab2973f596de3b640bdc087bf2d46bcfa

>  It is the user-level function for completing the process of making the object usable for execution. It should be called after sections within an object have been relocated using mapSectionAddress. When this method is called the MCJIT execution engine will reapply relocations for a loaded object. This method has no effect for the interpeter.


So judging by the documentation, the current C bindings and the implementation of MCJIT (e.g. LLVMRunFunction calls finalizeObject() before everything else) you can call it more than once without a change and it should be idempotent, if there were no changes made to the module. If there were changes calling it is also wanted.


http://reviews.llvm.org/D16188





More information about the llvm-commits mailing list