[PATCH] D10945: Verifier: Forbid comdats on linker declarations.
Peter Collingbourne
peter at pcc.me.uk
Sat Jul 4 15:32:50 PDT 2015
pcc created this revision.
pcc added a reviewer: rafael.
pcc added a subscriber: llvm-commits.
Depends on http://reviews.llvm.org/D10941
http://reviews.llvm.org/D10945
Files:
lib/IR/Verifier.cpp
test/Verifier/comdat-decl1.ll
test/Verifier/comdat-decl2.ll
Index: test/Verifier/comdat-decl2.ll
===================================================================
--- /dev/null
+++ test/Verifier/comdat-decl2.ll
@@ -0,0 +1,5 @@
+; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+
+$v = comdat any
+ at v = external global i32, comdat
+; CHECK: Declaration may not be in a Comdat!
Index: test/Verifier/comdat-decl1.ll
===================================================================
--- /dev/null
+++ test/Verifier/comdat-decl1.ll
@@ -0,0 +1,5 @@
+; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+
+$v = comdat any
+ at v = available_externally global i32 0, comdat
+; CHECK: Declaration may not be in a Comdat!
Index: lib/IR/Verifier.cpp
===================================================================
--- lib/IR/Verifier.cpp
+++ lib/IR/Verifier.cpp
@@ -438,6 +438,9 @@
Assert(GVar && GVar->getValueType()->isArrayTy(),
"Only global arrays can have appending linkage!", GVar);
}
+
+ if (GV.isDeclarationForLinker())
+ Assert(!GV.hasComdat(), "Declaration may not be in a Comdat!", &GV);
}
void Verifier::visitGlobalVariable(const GlobalVariable &GV) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10945.29050.patch
Type: text/x-patch
Size: 1135 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150704/9e16a80e/attachment.bin>
More information about the llvm-commits
mailing list