forked from OSchip/llvm-project
Verifier: Forbid comdats on linker declarations.
Differential Revision: http://reviews.llvm.org/D10945 llvm-svn: 241414
This commit is contained in:
parent
6a9d1774d0
commit
46eb0f539c
llvm
|
@ -438,6 +438,9 @@ void Verifier::visitGlobalValue(const GlobalValue &GV) {
|
|||
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) {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
$v = comdat any
|
||||
@v = available_externally global i32 0, comdat
|
||||
; CHECK: Declaration may not be in a Comdat!
|
|
@ -0,0 +1,5 @@
|
|||
; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
|
||||
|
||||
$v = comdat any
|
||||
@v = external global i32, comdat
|
||||
; CHECK: Declaration may not be in a Comdat!
|
Loading…
Reference in New Issue