[PATCH] D10945: Verifier: Forbid comdats on linker declarations.

Peter Collingbourne peter at pcc.me.uk
Sun Jul 5 13:53:00 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL241414: Verifier: Forbid comdats on linker declarations. (authored by pcc).

Changed prior to commit:
  http://reviews.llvm.org/D10945?vs=29050&id=29058#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D10945

Files:
  llvm/trunk/lib/IR/Verifier.cpp
  llvm/trunk/test/Verifier/comdat-decl1.ll
  llvm/trunk/test/Verifier/comdat-decl2.ll

Index: llvm/trunk/test/Verifier/comdat-decl1.ll
===================================================================
--- llvm/trunk/test/Verifier/comdat-decl1.ll
+++ llvm/trunk/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: llvm/trunk/test/Verifier/comdat-decl2.ll
===================================================================
--- llvm/trunk/test/Verifier/comdat-decl2.ll
+++ llvm/trunk/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: llvm/trunk/lib/IR/Verifier.cpp
===================================================================
--- llvm/trunk/lib/IR/Verifier.cpp
+++ llvm/trunk/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.29058.patch
Type: text/x-patch
Size: 1274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150705/a1e297d1/attachment.bin>


More information about the llvm-commits mailing list