Delete broken code.

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

The symbol name was already available.

llvm-svn: 244220
This commit is contained in:
Rafael Espindola 2015-08-06 15:33:21 +00:00
parent 49a2ca6ddd
commit df1e05a26c
3 changed files with 4 additions and 21 deletions

View File

@ -71,7 +71,7 @@ SymbolBody *elf2::ObjectFile<ELFT>::createSymbolBody(StringRef StringTable,
StringRef Name = *NameOrErr; StringRef Name = *NameOrErr;
if (Sym->isUndefined()) if (Sym->isUndefined())
return new (Alloc) Undefined(Name); return new (Alloc) Undefined(Name);
return new (Alloc) DefinedRegular<ELFT>(this, Sym); return new (Alloc) DefinedRegular<ELFT>(Name);
} }
namespace lld { namespace lld {

View File

@ -18,22 +18,8 @@ using namespace lld;
using namespace lld::elf2; using namespace lld::elf2;
template <class ELFT> template <class ELFT>
static StringRef DefinedRegular<ELFT>::DefinedRegular(StringRef Name)
getSymbolName(const llvm::object::ELFFile<ELFT> *F, : Defined(DefinedRegularKind, Name) {}
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) {}
// Returns 1, 0 or -1 if this symbol should take precedence // Returns 1, 0 or -1 if this symbol should take precedence
// over the Other, tie or lose, respectively. // over the Other, tie or lose, respectively.

View File

@ -87,14 +87,11 @@ template <class ELFT> class DefinedRegular : public Defined {
typedef typename llvm::object::ELFFile<ELFT>::Elf_Sym Elf_Sym; typedef typename llvm::object::ELFFile<ELFT>::Elf_Sym Elf_Sym;
public: public:
DefinedRegular(ObjectFile<ELFT> *F, const Elf_Sym *S); DefinedRegular(StringRef Name);
static bool classof(const SymbolBody *S) { static bool classof(const SymbolBody *S) {
return S->kind() == DefinedRegularKind; return S->kind() == DefinedRegularKind;
} }
private:
ObjectFile<ELFT> *File;
}; };
// Undefined symbols. // Undefined symbols.