1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Correctly merge available_externally and regular definitions when they have

different visibilities.

llvm-svn: 124650
This commit is contained in:
Rafael Espindola 2011-02-01 05:33:52 +00:00
parent 3689d1302d
commit e60f9519d8
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
if (Dest && Src->getVisibility() != Dest->getVisibility())
if (!Src->isDeclaration() && !Dest->isDeclaration())
if (Dest && Src->getVisibility() != Dest->getVisibility() &&
!Src->isDeclaration() && !Dest->isDeclaration() &&
!Src->hasAvailableExternallyLinkage() &&
!Dest->hasAvailableExternallyLinkage())
return Error(Err, "Linking globals named '" + Src->getName() +
"': symbols have different visibilities!");
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