mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-23 11:04:49 +00:00
Synchronize the logic for deciding to link a gv.
We were deciding to not link an available_externally gv over a declaration, but then copying over the body anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255169 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
49c4c7b2a7
commit
fad81ab170
@ -1050,7 +1050,12 @@ bool ModuleLinker::shouldLinkFromSource(bool &LinkFromSrc,
|
||||
return false;
|
||||
}
|
||||
// If the Dest is weak, use the source linkage.
|
||||
LinkFromSrc = Dest.hasExternalWeakLinkage();
|
||||
if (Dest.hasExternalWeakLinkage()) {
|
||||
LinkFromSrc = true;
|
||||
return false;
|
||||
}
|
||||
// Link an available_externally over a declaration.
|
||||
LinkFromSrc = !Src.isDeclaration() && Dest.isDeclaration();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
5
test/Linker/Inputs/available_externally_over_decl.ll
Normal file
5
test/Linker/Inputs/available_externally_over_decl.ll
Normal file
@ -0,0 +1,5 @@
|
||||
@h = global void ()* @f
|
||||
|
||||
define available_externally void @f() {
|
||||
ret void
|
||||
}
|
9
test/Linker/available_externally_over_decl.ll
Normal file
9
test/Linker/available_externally_over_decl.ll
Normal file
@ -0,0 +1,9 @@
|
||||
; RUN: llvm-link -S %s %p/Inputs/available_externally_over_decl.ll | FileCheck %s
|
||||
|
||||
declare void @f()
|
||||
|
||||
define void ()* @main() {
|
||||
ret void ()* @f
|
||||
}
|
||||
|
||||
; CHECK: define available_externally void @f() {
|
Loading…
x
Reference in New Issue
Block a user