Correctly merge available_externally and regular definitions when they have

different visibilities.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124650 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2011-02-01 05:33:52 +00:00
parent e087afa128
commit 4e93885bab
3 changed files with 13 additions and 2 deletions

View File

@ -434,8 +434,10 @@ static bool GetLinkageResult(GlobalValue *Dest, const GlobalValue *Src,
} }
// Check visibility // Check visibility
if (Dest && Src->getVisibility() != Dest->getVisibility()) if (Dest && Src->getVisibility() != Dest->getVisibility() &&
if (!Src->isDeclaration() && !Dest->isDeclaration()) !Src->isDeclaration() && !Dest->isDeclaration() &&
!Src->hasAvailableExternallyLinkage() &&
!Dest->hasAvailableExternallyLinkage())
return Error(Err, "Linking globals named '" + Src->getName() + return Error(Err, "Linking globals named '" + Src->getName() +
"': symbols have different visibilities!"); "': symbols have different visibilities!");
return false; return false;

View File

@ -0,0 +1,5 @@
; RUN: llvm-link %s %p/available_externally_b.ll -S -o - | FileCheck %s
@foo = available_externally unnamed_addr constant i32 0
; CHECK: @foo = hidden unnamed_addr constant i32 0

View File

@ -0,0 +1,4 @@
; This file is for use with available_externally_a.ll
; RUN: true
@foo = hidden unnamed_addr constant i32 0