[lld] r244350 - Avoid using getDotDynSymSec in lld. It is going away.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 13:01:24 PDT 2015


Author: rafael
Date: Fri Aug  7 15:01:24 2015
New Revision: 244350

URL: http://llvm.org/viewvc/llvm-project?rev=244350&view=rev
Log:
Avoid using getDotDynSymSec in lld. It is going away.

Modified:
    lld/trunk/lib/ReaderWriter/ELF/DynamicFile.cpp

Modified: lld/trunk/lib/ReaderWriter/ELF/DynamicFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DynamicFile.cpp?rev=244350&r1=244349&r2=244350&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DynamicFile.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DynamicFile.cpp Fri Aug  7 15:01:24 2015
@@ -68,8 +68,11 @@ template <class ELFT> std::error_code Dy
   const char *base = _mb->getBuffer().data();
   const Elf_Dyn *dynStart = nullptr;
   const Elf_Dyn *dynEnd = nullptr;
+
+  const Elf_Shdr *dynSymSec = nullptr;
   for (const Elf_Shdr &sec : obj.sections()) {
-    if (sec.sh_type == llvm::ELF::SHT_DYNAMIC) {
+    switch (sec.sh_type) {
+    case llvm::ELF::SHT_DYNAMIC: {
       dynStart = reinterpret_cast<const Elf_Dyn *>(base + sec.sh_offset);
       uint64_t size = sec.sh_size;
       if (size % sizeof(Elf_Dyn))
@@ -77,9 +80,12 @@ template <class ELFT> std::error_code Dy
       dynEnd = dynStart + size / sizeof(Elf_Dyn);
       break;
     }
+    case llvm::ELF::SHT_DYNSYM:
+      dynSymSec = &sec;
+      break;
+    }
   }
 
-  const Elf_Shdr *dynSymSec = obj.getDotDynSymSec();
   ErrorOr<StringRef> strTableOrErr = obj.getStringTableForSymtab(*dynSymSec);
   if (std::error_code ec = strTableOrErr.getError())
     return ec;




More information about the llvm-commits mailing list