summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/SymbolTable.cpp17
-rw-r--r--lld/ELF/SymbolTable.h1
-rw-r--r--lld/ELF/Writer.cpp2
3 files changed, 1 insertions, 19 deletions
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index b0bd525009e..88747c7bb4c 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -164,23 +164,6 @@ template <class ELFT> void SymbolTable<ELFT>::wrap(StringRef Name) {
memcpy(Sym->Body.buffer, Wrap->Body.buffer, sizeof(Wrap->Body));
}
-// Returns a file from which symbol B was created.
-// If B does not belong to any file, returns a nullptr.
-template <class ELFT> InputFile *SymbolTable<ELFT>::findFile(SymbolBody *B) {
- // If this symbol has a definition, follow pointers in the symbol to its
- // defining file.
- if (auto *R = dyn_cast<DefinedRegular<ELFT>>(B))
- if (auto *S = R->Section)
- return S->getFile();
- if (auto *SS = dyn_cast<SharedSymbol<ELFT>>(B))
- return SS->File;
- if (auto *BC = dyn_cast<DefinedBitcode>(B))
- return BC->File;
- if (auto *U = dyn_cast<Undefined>(B))
- return U->File;
- return nullptr;
-}
-
static uint8_t getMinVisibility(uint8_t VA, uint8_t VB) {
if (VA == STV_DEFAULT)
return VB;
diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h
index 0a942faa09c..22be99c020c 100644
--- a/lld/ELF/SymbolTable.h
+++ b/lld/ELF/SymbolTable.h
@@ -84,7 +84,6 @@ public:
void scanVersionScript();
SymbolBody *find(StringRef Name);
void wrap(StringRef Name);
- InputFile *findFile(SymbolBody *B);
private:
std::pair<Symbol *, bool> insert(StringRef Name);
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 093fac8dfcb..7a4ec04c3df 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -785,7 +785,7 @@ static void reportUndefined(SymbolTable<ELFT> &Symtab, SymbolBody *Sym) {
}
std::string Msg = "undefined symbol: " + Sym->getName().str();
- if (InputFile *File = Symtab.findFile(Sym))
+ if (InputFile *File = Sym->getSourceFile<ELFT>())
Msg += " in " + File->getName().str();
if (Config->NoinhibitExec)
warning(Msg);
OpenPOWER on IntegriCloud