mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
Fix resolution of linkonce symbols in comdats.
After comdat processing, the symbols still go through regular symbol resolution. We were not doing it for linkonce symbols since they are lazy linked. This fixes pr27044. llvm-svn: 264288
This commit is contained in:
parent
b0144748c0
commit
e8152e3f49
@ -566,8 +566,14 @@ bool ModuleLinker::run() {
|
||||
const Comdat *SC = GV->getComdat();
|
||||
if (!SC)
|
||||
continue;
|
||||
for (GlobalValue *GV2 : LazyComdatMembers[SC])
|
||||
ValuesToLink.insert(GV2);
|
||||
for (GlobalValue *GV2 : LazyComdatMembers[SC]) {
|
||||
GlobalValue *DGV = getLinkedToGlobal(GV2);
|
||||
bool LinkFromSrc = true;
|
||||
if (DGV && shouldLinkFromSource(LinkFromSrc, *DGV, *GV2))
|
||||
return true;
|
||||
if (LinkFromSrc)
|
||||
ValuesToLink.insert(GV2);
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldInternalizeLinkedSymbols()) {
|
||||
|
7
test/Linker/Inputs/pr27044.ll
Normal file
7
test/Linker/Inputs/pr27044.ll
Normal file
@ -0,0 +1,7 @@
|
||||
$foo = comdat any
|
||||
define linkonce_odr i32 @f1() comdat($foo) {
|
||||
ret i32 1
|
||||
}
|
||||
define void @f2() comdat($foo) {
|
||||
ret void
|
||||
}
|
8
test/Linker/pr27044.ll
Normal file
8
test/Linker/pr27044.ll
Normal file
@ -0,0 +1,8 @@
|
||||
; RUN: llvm-link -S %s %p/Inputs/pr27044.ll -o - | FileCheck %s
|
||||
|
||||
; CHECK: define i32 @f1() {
|
||||
; CHECK: define void @f2() comdat($foo) {
|
||||
|
||||
define i32 @f1() {
|
||||
ret i32 0
|
||||
}
|
Loading…
Reference in New Issue
Block a user