mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-02 13:21:43 +00:00
Verifier: Forbid comdats on linker declarations.
Differential Revision: http://reviews.llvm.org/D10945 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241414 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ce2b45bd7d
commit
cf47c180e1
@ -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) {
|
||||
|
5
test/Verifier/comdat-decl1.ll
Normal file
5
test/Verifier/comdat-decl1.ll
Normal file
@ -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!
|
5
test/Verifier/comdat-decl2.ll
Normal file
5
test/Verifier/comdat-decl2.ll
Normal file
@ -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…
x
Reference in New Issue
Block a user