llvm.org GIT mirror llvm / 69ca26c
Fix use of uninitialized variable. Fixes linking bitcode files that use the new style comdats for constructors with ones that don't. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215364 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
3 changed file(s) with 26 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
643643 bool ModuleLinker::getComdatResult(const Comdat *SrcC,
644644 Comdat::SelectionKind &Result,
645645 bool &LinkFromSrc) {
646 Comdat::SelectionKind SSK = SrcC->getSelectionKind();
646647 StringRef ComdatName = SrcC->getName();
647648 Module::ComdatSymTabType &ComdatSymTab = DstM->getComdatSymbolTable();
648649 Module::ComdatSymTabType::iterator DstCI = ComdatSymTab.find(ComdatName);
649650
650 if (DstCI == ComdatSymTab.end())
651 if (DstCI == ComdatSymTab.end()) {
652 // Use the comdat if it is only available in one of the modules.
653 LinkFromSrc = true;
654 Result = SSK;
651655 return false;
656 }
652657
653658 const Comdat *DstC = &DstCI->second;
654 Comdat::SelectionKind SSK = SrcC->getSelectionKind();
655659 Comdat::SelectionKind DSK = DstC->getSelectionKind();
656660 return computeResultingSelectionKind(ComdatName, SSK, DSK, Result,
657661 LinkFromSrc);
0 define weak_odr void @_ZN3fooIiEC2Ev() {
1 ret void
2 }
3
4 define weak_odr void @_ZN3fooIiEC1Ev() {
5 ret void
6 }
0 ; RUN: llvm-link %s %p/Inputs/constructor-comdat.ll -S -o - 2>&1 | FileCheck %s
1 ; RUN: llvm-link %p/Inputs/constructor-comdat.ll %s -S -o - 2>&1 | FileCheck %s
2
3 $_ZN3fooIiEC5Ev = comdat any
4 ; CHECK: $_ZN3fooIiEC5Ev = comdat any
5
6 @_ZN3fooIiEC1Ev = weak_odr alias void ()* @_ZN3fooIiEC2Ev
7 ; CHECK: @_ZN3fooIiEC1Ev = weak_odr alias void ()* @_ZN3fooIiEC2Ev
8
9 ; CHECK: define weak_odr void @_ZN3fooIiEC2Ev() comdat $_ZN3fooIiEC5Ev {
10 define weak_odr void @_ZN3fooIiEC2Ev() comdat $_ZN3fooIiEC5Ev {
11 ret void
12 }