Create llvm.global_ctors in the new format.
authorRafael Espindola <rafael.espindola@gmail.com>
Sun, 6 Dec 2015 16:18:25 +0000 (16:18 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Sun, 6 Dec 2015 16:18:25 +0000 (16:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254878 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/ModuleUtils.cpp
test/Instrumentation/SanitizerCoverage/coverage.ll

index c5abf76d93faa3c36caec8eff090f88501f7527d..9ec28a3f3d47c8201143b77485d1b24bc9305dfd 100644 (file)
@@ -43,9 +43,9 @@ static void appendToGlobalArray(const char *Array,
     }
     GVCtor->eraseFromParent();
   } else {
     }
     GVCtor->eraseFromParent();
   } else {
-    // Use a simple two-field struct if there isn't one already.
+    // Use the new three-field struct if there isn't one already.
     EltTy = StructType::get(IRB.getInt32Ty(), PointerType::getUnqual(FnTy),
     EltTy = StructType::get(IRB.getInt32Ty(), PointerType::getUnqual(FnTy),
-                            nullptr);
+                            IRB.getInt8PtrTy(), nullptr);
   }
 
   // Build a 2 or 3 field global_ctor entry.  We don't take a comdat key.
   }
 
   // Build a 2 or 3 field global_ctor entry.  We don't take a comdat key.
index 659c03040f2f94e1a5bc4eb12620e40ea52418a3..71fdbbb5ada7c6381cf657bf0dd50acab3752f6f 100644 (file)
@@ -29,8 +29,8 @@ entry:
 }
 
 ; CHECK0-NOT: @llvm.global_ctors = {{.*}}{ i32 2, void ()* @sancov.module_ctor }
 }
 
 ; CHECK0-NOT: @llvm.global_ctors = {{.*}}{ i32 2, void ()* @sancov.module_ctor }
-; CHECK1: @llvm.global_ctors = {{.*}}{ i32 2, void ()* @sancov.module_ctor }
-; CHECK2: @llvm.global_ctors = {{.*}}{ i32 2, void ()* @sancov.module_ctor }
+; CHECK1: @llvm.global_ctors = {{.*}}{ i32 2, void ()* @sancov.module_ctor, i8* null }
+; CHECK2: @llvm.global_ctors = {{.*}}{ i32 2, void ()* @sancov.module_ctor, i8* null }
 
 ; CHECK0-NOT: call void @__sanitizer_cov(
 ; CHECK0-NOT: call void @__sanitizer_cov_module_init(
 
 ; CHECK0-NOT: call void @__sanitizer_cov(
 ; CHECK0-NOT: call void @__sanitizer_cov_module_init(