diff options
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/MachineModuleInfoImpls.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 26 |
2 files changed, 22 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp b/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp index 39d2c7504f0..5ab56c09f5f 100644 --- a/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfoImpls.cpp @@ -25,10 +25,9 @@ void MachineModuleInfoMachO::Anchor() {} void MachineModuleInfoELF::Anchor() {} static int SortSymbolPair(const void *LHS, const void *RHS) { - const MCSymbol *LHSS = - ((const std::pair<MCSymbol*, MCSymbol*>*)LHS)->first; - const MCSymbol *RHSS = - ((const std::pair<MCSymbol*, MCSymbol*>*)RHS)->first; + typedef std::pair<MCSymbol*, MachineModuleInfoImpl::StubValueTy> PairTy; + const MCSymbol *LHSS = ((const PairTy *)LHS)->first; + const MCSymbol *RHSS = ((const PairTy *)RHS)->first; return LHSS->getName().compare(RHSS->getName()); } @@ -36,7 +35,7 @@ static int SortSymbolPair(const void *LHS, const void *RHS) { /// sorted orer. MachineModuleInfoImpl::SymbolListTy MachineModuleInfoImpl::GetSortedStubs(const DenseMap<MCSymbol*, - MCSymbol*> &Map) { + MachineModuleInfoImpl::StubValueTy>&Map) { MachineModuleInfoImpl::SymbolListTy List(Map.begin(), Map.end()); if (!List.empty()) diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 2014b429bd9..169e2cae1f8 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -404,14 +404,19 @@ getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, // Add information about the stub reference to ELFMMI so that the stub // gets emitted by the asmprinter. MCSymbol *Sym = getContext().GetOrCreateTemporarySymbol(Name.str()); - MCSymbol *&StubSym = ELFMMI.getGVStubEntry(Sym); - if (StubSym == 0) { + MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(Sym); + if (StubSym.getPointer() == 0) { Name.clear(); Mang->getNameWithPrefix(Name, GV, false); + if (GV->hasPrivateLinkage()) - StubSym = getContext().GetOrCreateTemporarySymbol(Name.str()); + StubSym = MachineModuleInfoImpl:: + StubValueTy(getContext().GetOrCreateTemporarySymbol(Name.str()), + false); else - StubSym = getContext().GetOrCreateSymbol(Name.str()); + StubSym = MachineModuleInfoImpl:: + StubValueTy(getContext().GetOrCreateSymbol(Name.str()), + !GV->hasInternalLinkage()); } return TargetLoweringObjectFile:: @@ -761,14 +766,19 @@ getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang, // Add information about the stub reference to MachOMMI so that the stub // gets emitted by the asmprinter. MCSymbol *Sym = getContext().GetOrCreateTemporarySymbol(Name.str()); - MCSymbol *&StubSym = MachOMMI.getGVStubEntry(Sym); - if (StubSym == 0) { + MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(Sym); + if (StubSym.getPointer() == 0) { Name.clear(); Mang->getNameWithPrefix(Name, GV, false); + if (GV->hasPrivateLinkage()) - StubSym = getContext().GetOrCreateTemporarySymbol(Name.str()); + StubSym = MachineModuleInfoImpl:: + StubValueTy(getContext().GetOrCreateTemporarySymbol(Name.str()), + false); else - StubSym = getContext().GetOrCreateSymbol(Name.str()); + StubSym = MachineModuleInfoImpl:: + StubValueTy(getContext().GetOrCreateSymbol(Name.str()), + !GV->hasInternalLinkage()); } return TargetLoweringObjectFile:: |