forked from OSchip/llvm-project
Prefer common over weak linkage when linking.
This matches the behavior of ELF linkers. llvm-svn: 217443
This commit is contained in:
parent
91ea478d7c
commit
7fc29546f9
|
@ -721,8 +721,9 @@ bool ModuleLinker::getLinkageResult(GlobalValue *Dest, const GlobalValue *Src,
|
|||
} else if (Src->isWeakForLinker()) {
|
||||
assert(!Dest->hasExternalWeakLinkage());
|
||||
assert(!Dest->hasAvailableExternallyLinkage());
|
||||
if (Dest->hasLinkOnceLinkage() &&
|
||||
(Src->hasWeakLinkage() || Src->hasCommonLinkage())) {
|
||||
if ((Dest->hasLinkOnceLinkage() && Src->hasWeakLinkage()) ||
|
||||
((Dest->hasLinkOnceLinkage() || Dest->hasWeakLinkage()) &&
|
||||
Src->hasCommonLinkage())) {
|
||||
LinkFromSrc = true;
|
||||
LT = Src->getLinkage();
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
@test1_a = weak global i8 1
|
|
@ -0,0 +1,6 @@
|
|||
; RUN: llvm-link %s %p/Inputs/linkage2.ll -S | FileCheck %s
|
||||
; RUN: llvm-link %p/Inputs/linkage2.ll %s -S | FileCheck %s
|
||||
|
||||
@test1_a = common global i8 0
|
||||
|
||||
; CHECK: @test1_a = common global i8 0
|
Loading…
Reference in New Issue