diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/MC/MCContext.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index 2afa21219fc..2cb81d06b05 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -291,6 +291,12 @@ const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type, unsigned Flags, unsigned EntrySize, StringRef Group, bool Unique, const char *BeginSymName) { + MCSymbol *GroupSym = nullptr; + if (!Group.empty()) { + GroupSym = GetOrCreateSymbol(Group); + Group = GroupSym->getName(); + } + // Do the lookup, if we have a hit, return it. auto IterBool = ELFUniquingMap.insert( std::make_pair(ELFSectionKey{Section, Group}, nullptr)); @@ -298,10 +304,6 @@ const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type, if (!IterBool.second && !Unique) return Entry.second; - MCSymbol *GroupSym = nullptr; - if (!Group.empty()) - GroupSym = GetOrCreateSymbol(Group); - StringRef CachedName = Entry.first.SectionName; SectionKind Kind; @@ -340,18 +342,19 @@ const MCSectionCOFF * MCContext::getCOFFSection(StringRef Section, unsigned Characteristics, SectionKind Kind, StringRef COMDATSymName, int Selection, const char *BeginSymName) { - // Do the lookup, if we have a hit, return it. + MCSymbol *COMDATSymbol = nullptr; + if (!COMDATSymName.empty()) { + COMDATSymbol = GetOrCreateSymbol(COMDATSymName); + COMDATSymName = COMDATSymbol->getName(); + } + // Do the lookup, if we have a hit, return it. COFFSectionKey T{Section, COMDATSymName, Selection}; auto IterBool = COFFUniquingMap.insert(std::make_pair(T, nullptr)); auto Iter = IterBool.first; if (!IterBool.second) return Iter->second; - MCSymbol *COMDATSymbol = nullptr; - if (!COMDATSymName.empty()) - COMDATSymbol = GetOrCreateSymbol(COMDATSymName); - MCSymbol *Begin = nullptr; if (BeginSymName) Begin = createTempSymbol(BeginSymName, false); |