[lld] r244220 - Delete broken code.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 08:33:21 PDT 2015


Author: rafael
Date: Thu Aug  6 10:33:21 2015
New Revision: 244220

URL: http://llvm.org/viewvc/llvm-project?rev=244220&view=rev
Log:
Delete broken code.

This was using a hard coded string table and getting it for every symbol.

The symbol name was already available.

Modified:
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/ELF/Symbols.cpp
    lld/trunk/ELF/Symbols.h

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=244220&r1=244219&r2=244220&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Thu Aug  6 10:33:21 2015
@@ -71,7 +71,7 @@ SymbolBody *elf2::ObjectFile<ELFT>::crea
   StringRef Name = *NameOrErr;
   if (Sym->isUndefined())
     return new (Alloc) Undefined(Name);
-  return new (Alloc) DefinedRegular<ELFT>(this, Sym);
+  return new (Alloc) DefinedRegular<ELFT>(Name);
 }
 
 namespace lld {

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=244220&r1=244219&r2=244220&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Thu Aug  6 10:33:21 2015
@@ -18,22 +18,8 @@ using namespace lld;
 using namespace lld::elf2;
 
 template <class ELFT>
-static StringRef
-getSymbolName(const llvm::object::ELFFile<ELFT> *F,
-  const typename llvm::object::ELFFile<ELFT>::Elf_Sym *S) {
-  ErrorOr<StringRef> StrTabOrErr =
-      F->getStringTableForSymtab(*F->getDotSymtabSec());
-  error(StrTabOrErr, "Invalid string table.");
-  StringRef StrTab = *StrTabOrErr;
-  if (S->st_name >= StrTab.size())
-    error("Invalid string table offset");
-  return StrTab.data() + S->st_name;
-}
-
-template <class ELFT>
-DefinedRegular<ELFT>::DefinedRegular(ObjectFile<ELFT> *F, const Elf_Sym *S)
-    : Defined(DefinedRegularKind, getSymbolName<ELFT>(F->getObj(), S)),
-      File(F) {}
+DefinedRegular<ELFT>::DefinedRegular(StringRef Name)
+    : Defined(DefinedRegularKind, Name) {}
 
 // Returns 1, 0 or -1 if this symbol should take precedence
 // over the Other, tie or lose, respectively.

Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=244220&r1=244219&r2=244220&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Thu Aug  6 10:33:21 2015
@@ -87,14 +87,11 @@ template <class ELFT> class DefinedRegul
   typedef typename llvm::object::ELFFile<ELFT>::Elf_Sym Elf_Sym;
 
 public:
-  DefinedRegular(ObjectFile<ELFT> *F, const Elf_Sym *S);
+  DefinedRegular(StringRef Name);
 
   static bool classof(const SymbolBody *S) {
     return S->kind() == DefinedRegularKind;
   }
-
-private:
-  ObjectFile<ELFT> *File;
 };
 
 // Undefined symbols.




More information about the llvm-commits mailing list