Error on linking appending globals with different unnamed_addr.

llvm-svn: 189950
This commit is contained in:
Rafael Espindola 2013-09-04 15:33:34 +00:00
parent 6272680119
commit fac3a018d1
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()) if (DstGV->getVisibility() != SrcGV->getVisibility())
return emitError( return emitError(
"Appending variables with different visibility need to be linked!"); "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()) if (DstGV->getSection() != SrcGV->getSection())
return emitError( return emitError(
"Appending variables with different section name need to be linked!"); "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]