From c9d069222e4307acb25288c3b2614c0e93560d51 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 30 Mar 2015 13:39:16 +0000 Subject: Special case the creation of relocation sections. These sections are never looked up and we know when have to create them. Use that to save adding them to the regular map and avoid a symbol->string->symbol conversion for the group symbol. This also makes the implementation independent of the details of how unique sections are implemented. llvm-svn: 233539 --- llvm/lib/MC/MCContext.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'llvm/lib/MC/MCContext.cpp') diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index 09de4ee05e6..2afa21219fc 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -275,6 +275,18 @@ void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) { const_cast(Section)->setSectionName(CachedName); } +const MCSectionELF * +MCContext::createELFRelSection(StringRef Name, unsigned Type, unsigned Flags, + unsigned EntrySize, const MCSymbol *Group) { + StringMap::iterator I; + bool Inserted; + std::tie(I, Inserted) = ELFRelSecNames.insert(std::make_pair(Name, true)); + + return new (*this) + MCSectionELF(I->getKey(), Type, Flags, SectionKind::getReadOnly(), + EntrySize, Group, true, nullptr); +} + const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type, unsigned Flags, unsigned EntrySize, StringRef Group, bool Unique, -- cgit v1.2.3