OSDN Git Service

LLVMRunStaticConstructors can be called before object is finalized, #24028
authorAmaury Sechet <deadalnix@gmail.com>
Fri, 15 Jan 2016 00:23:34 +0000 (00:23 +0000)
committerAmaury Sechet <deadalnix@gmail.com>
Fri, 15 Jan 2016 00:23:34 +0000 (00:23 +0000)
Summary: Since you cannot call finalizeObject manually through the C-API and other functions from the C-API automatically call it, LLVMRunStaticConstructors should also call it or otherwise you cannot call it without first calling a workaround function (or call any other function from the C-API which implicitly finalizes the object).

Reviewers: dnovillo, spatel, bkramer, deadalnix, joker.eph, echristo, lhames

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D16188

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257849 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/ExecutionEngineBindings.cpp

index ff7c4dc..3b2eb16 100644 (file)
@@ -215,10 +215,12 @@ void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE) {
 }
 
 void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE) {
+  unwrap(EE)->finalizeObject();
   unwrap(EE)->runStaticConstructorsDestructors(false);
 }
 
 void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE) {
+  unwrap(EE)->finalizeObject();
   unwrap(EE)->runStaticConstructorsDestructors(true);
 }