mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Fix recursive -only-needed.
We were assuming that only linkonce_odr GVs were lazy linked. llvm-svn: 266995
This commit is contained in:
parent
173f170236
commit
7e0cfdf745
@ -849,9 +849,11 @@ bool IRLinker::shouldLink(GlobalValue *DGV, GlobalValue &SGV) {
|
||||
if (SGV.hasAvailableExternallyLinkage())
|
||||
return true;
|
||||
|
||||
if (DoneLinkingBodies)
|
||||
if (SGV.isDeclaration())
|
||||
return false;
|
||||
|
||||
if (DoneLinkingBodies)
|
||||
return false;
|
||||
|
||||
// Callback to the client to give a chance to lazily add the Global to the
|
||||
// list of value to link.
|
||||
|
@ -423,7 +423,7 @@ void ModuleLinker::addLazyFor(GlobalValue &GV, IRMover::ValueAdder Add) {
|
||||
return;
|
||||
|
||||
// Add these to the internalize list
|
||||
if (!GV.hasLinkOnceLinkage())
|
||||
if (!GV.hasLinkOnceLinkage() && !shouldLinkOnlyNeeded())
|
||||
return;
|
||||
|
||||
if (shouldInternalizeLinkedSymbols())
|
||||
|
8
test/Linker/Inputs/only-needed-recurse.ll
Normal file
8
test/Linker/Inputs/only-needed-recurse.ll
Normal file
@ -0,0 +1,8 @@
|
||||
define void @f2() {
|
||||
call void @f3()
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @f3() {
|
||||
ret void
|
||||
}
|
11
test/Linker/only-needed-recurse.ll
Normal file
11
test/Linker/only-needed-recurse.ll
Normal file
@ -0,0 +1,11 @@
|
||||
; RUN: llvm-link -S -only-needed %s %p/Inputs/only-needed-recurse.ll | FileCheck %s
|
||||
|
||||
declare void @f2()
|
||||
|
||||
define void @f1() {
|
||||
call void @f2()
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define void @f3
|
||||
|
Loading…
Reference in New Issue
Block a user