[lld] r244511 - Update for llvm api change.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 14:30:13 PDT 2015


Author: rafael
Date: Mon Aug 10 16:30:13 2015
New Revision: 244511

URL: http://llvm.org/viewvc/llvm-project?rev=244511&view=rev
Log:
Update for llvm api change.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/ELFFile.cpp
    lld/trunk/lib/ReaderWriter/ELF/ELFFile.h

Modified: lld/trunk/lib/ReaderWriter/ELF/ELFFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFFile.cpp?rev=244511&r1=244510&r2=244511&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFFile.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFFile.cpp Mon Aug 10 16:30:13 2015
@@ -125,9 +125,17 @@ std::error_code ELFFile<ELFT>::createAto
   // Record the number of relocs to guess at preallocating the buffer.
   uint64_t totalRelocs = 0;
   for (const Elf_Shdr &section : _objFile->sections()) {
-    if (section.sh_type == llvm::ELF::SHT_SYMTAB) {
+    switch (section.sh_type) {
+    case llvm::ELF::SHT_SYMTAB:
       _symtab = §ion;
       continue;
+    case llvm::ELF::SHT_SYMTAB_SHNDX: {
+      ErrorOr<ArrayRef<Elf_Word>> tableOrErr = _objFile->getSHNDXTable(section);
+      if (std::error_code ec = tableOrErr.getError())
+        return ec;
+      _shndxTable = *tableOrErr;
+      continue;
+    }
     }
 
     if (isIgnoredSection(&section))
@@ -228,7 +236,8 @@ std::error_code ELFFile<ELFT>::createSym
   ++SymI;
 
   for (; SymI != SymE; ++SymI) {
-    ErrorOr<const Elf_Shdr *> section = _objFile->getSection(SymI);
+    ErrorOr<const Elf_Shdr *> section =
+        _objFile->getSection(SymI, _symtab, _shndxTable);
     if (std::error_code ec = section.getError())
       return ec;
 
@@ -673,7 +682,8 @@ template <class ELFT> void ELFFile<ELFT>
       continue;
     const Elf_Sym *symbol =
         _objFile->getSymbol(_symtab, ri->targetSymbolIndex());
-    ErrorOr<const Elf_Shdr *> shdr = _objFile->getSection(symbol);
+    ErrorOr<const Elf_Shdr *> shdr =
+        _objFile->getSection(symbol, _symtab, _shndxTable);
 
     // If the atom is not in mergeable string section, the target atom is
     // simply that atom.

Modified: lld/trunk/lib/ReaderWriter/ELF/ELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFFile.h?rev=244511&r1=244510&r2=244511&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFFile.h Mon Aug 10 16:30:13 2015
@@ -321,6 +321,7 @@ protected:
   llvm::BumpPtrAllocator _readerStorage;
   std::unique_ptr<llvm::object::ELFFile<ELFT> > _objFile;
   const Elf_Shdr *_symtab = nullptr;
+  ArrayRef<Elf_Word> _shndxTable;
 
   /// \brief _relocationAddendReferences and _relocationReferences contain the
   /// list of relocations references.  In ELF, if a section named, ".text" has




More information about the llvm-commits mailing list