mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
Set comdats when lazily linking functions.
We were setting the comdat when functions were copied in the initial pass, but not when they were linked only when we found out that they are needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215765 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9ad3f9b8e1
commit
0549fc2448
@ -546,6 +546,11 @@ Value *ValueMaterializerTy::materializeValueFor(Value *V) {
|
||||
SF->getLinkage(), SF->getName(), DstM);
|
||||
copyGVAttributes(DF, SF);
|
||||
|
||||
if (Comdat *SC = SF->getComdat()) {
|
||||
Comdat *DC = DstM->getOrInsertComdat(SC->getName());
|
||||
DF->setComdat(DC);
|
||||
}
|
||||
|
||||
LazilyLinkFunctions.push_back(SF);
|
||||
return DF;
|
||||
}
|
||||
|
5
test/Linker/Inputs/comdat9.ll
Normal file
5
test/Linker/Inputs/comdat9.ll
Normal file
@ -0,0 +1,5 @@
|
||||
$c = comdat any
|
||||
@a = alias void ()* @f
|
||||
define internal void @f() comdat $c {
|
||||
ret void
|
||||
}
|
7
test/Linker/comdat9.ll
Normal file
7
test/Linker/comdat9.ll
Normal file
@ -0,0 +1,7 @@
|
||||
; RUN: llvm-link %s %p/Inputs/comdat9.ll -S -o - | FileCheck %s
|
||||
|
||||
; CHECK: $c = comdat any
|
||||
; CHECK: @a = alias void ()* @f
|
||||
; CHECK: define internal void @f() comdat $c {
|
||||
; CHECK: ret void
|
||||
; CHECK: }
|
Loading…
Reference in New Issue
Block a user