Add r228888 back.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 17 Feb 2015 20:37:50 +0000 (20:37 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 17 Feb 2015 20:37:50 +0000 (20:37 +0000)
Original message:

Use the existing SymbolTableIndex instead of doing a lookup. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229538 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/ELFObjectWriter.cpp

index bd86e610715e7d5738ca238b13b4c0335e6d2fe9..27b607f520efd0e5c6ff715ee9305ea726db2593 100644 (file)
@@ -1509,11 +1509,7 @@ void ELFObjectWriter::WriteSection(MCAssembler &Asm,
 
   case ELF::SHT_REL:
   case ELF::SHT_RELA: {
-    const MCSectionELF *SymtabSection;
-    const MCSectionELF *InfoSection;
-    SymtabSection =
-        Asm.getContext().getELFSection(".symtab", ELF::SHT_SYMTAB, 0);
-    sh_link = SectionIndexMap.lookup(SymtabSection);
+    sh_link = SymbolTableIndex;
     assert(sh_link && ".symtab not found");
 
     // Remove ".rel" and ".rela" prefixes.
@@ -1522,8 +1518,8 @@ void ELFObjectWriter::WriteSection(MCAssembler &Asm,
     StringRef GroupName =
         Section.getGroup() ? Section.getGroup()->getName() : "";
 
-    InfoSection = Asm.getContext().getELFSection(SectionName, ELF::SHT_PROGBITS,
-                                                 0, 0, GroupName);
+    const MCSectionELF *InfoSection = Asm.getContext().getELFSection(
+        SectionName, ELF::SHT_PROGBITS, 0, 0, GroupName);
     sh_info = SectionIndexMap.lookup(InfoSection);
     break;
   }