Error on linking appending globals with different unnamed_addr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189950 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2013-09-04 15:33:34 +00:00
parent bf34f34642
commit 9127334dad
3 changed files with 13 additions and 1 deletions

View File

@ -704,7 +704,11 @@ bool ModuleLinker::linkAppendingVarProto(GlobalVariable *DstGV,
if (DstGV->getVisibility() != SrcGV->getVisibility())
return emitError(
"Appending variables with different visibility need to be linked!");
if (DstGV->hasUnnamedAddr() != SrcGV->hasUnnamedAddr())
return emitError(
"Appending variables with different unnamed_addr need to be linked!");
if (DstGV->getSection() != SrcGV->getSection())
return emitError(
"Appending variables with different section name need to be linked!");

View File

@ -0,0 +1,4 @@
; RUN: not llvm-link %s %p/unnamed-addr-err-b.ll -S -o - 2>&1 | FileCheck %s
@foo = appending unnamed_addr global [1 x i32] [i32 42]
; CHECK: Appending variables with different unnamed_addr need to be linked

View File

@ -0,0 +1,4 @@
; This file is for use with unnamed-addr-err-a.ll
; RUN: true
@foo = appending global [1 x i32] [i32 42]