forked from OSchip/llvm-project
parent
9b9dd84c8e
commit
8a9f90e669
|
@ -127,9 +127,9 @@ template <class ELFT> bool SymbolTable<ELFT>::isUndefined(StringRef Name) {
|
|||
// Returns a file from which symbol B was created.
|
||||
// If B does not belong to any file in ObjectFiles, returns a nullptr.
|
||||
template <class ELFT>
|
||||
static ELFFileBase<ELFT> *
|
||||
findFile(std::vector<std::unique_ptr<ObjectFile<ELFT>>> &ObjectFiles,
|
||||
SymbolBody *B) {
|
||||
ELFFileBase<ELFT> *
|
||||
elf2::findFile(ArrayRef<std::unique_ptr<ObjectFile<ELFT>>> ObjectFiles,
|
||||
const SymbolBody *B) {
|
||||
typedef typename ELFFile<ELFT>::Elf_Sym Elf_Sym;
|
||||
typedef typename ELFFile<ELFT>::Elf_Sym_Range Elf_Sym_Range;
|
||||
|
||||
|
@ -144,8 +144,8 @@ findFile(std::vector<std::unique_ptr<ObjectFile<ELFT>>> &ObjectFiles,
|
|||
|
||||
template <class ELFT>
|
||||
std::string SymbolTable<ELFT>::conflictMsg(SymbolBody *Old, SymbolBody *New) {
|
||||
ELFFileBase<ELFT> *OldFile = findFile(ObjectFiles, Old);
|
||||
ELFFileBase<ELFT> *NewFile = findFile(ObjectFiles, New);
|
||||
ELFFileBase<ELFT> *OldFile = findFile<ELFT>(ObjectFiles, Old);
|
||||
ELFFileBase<ELFT> *NewFile = findFile<ELFT>(ObjectFiles, New);
|
||||
|
||||
StringRef Sym = Old->getName();
|
||||
StringRef F1 = OldFile ? OldFile->getName() : "(internal)";
|
||||
|
@ -257,3 +257,16 @@ template class lld::elf2::SymbolTable<ELF32LE>;
|
|||
template class lld::elf2::SymbolTable<ELF32BE>;
|
||||
template class lld::elf2::SymbolTable<ELF64LE>;
|
||||
template class lld::elf2::SymbolTable<ELF64BE>;
|
||||
|
||||
template ELFFileBase<ELF32LE> *
|
||||
lld::elf2::findFile(ArrayRef<std::unique_ptr<ObjectFile<ELF32LE>>>,
|
||||
const SymbolBody *);
|
||||
template ELFFileBase<ELF32BE> *
|
||||
lld::elf2::findFile(ArrayRef<std::unique_ptr<ObjectFile<ELF32BE>>>,
|
||||
const SymbolBody *);
|
||||
template ELFFileBase<ELF64LE> *
|
||||
lld::elf2::findFile(ArrayRef<std::unique_ptr<ObjectFile<ELF64LE>>>,
|
||||
const SymbolBody *);
|
||||
template ELFFileBase<ELF64BE> *
|
||||
lld::elf2::findFile(ArrayRef<std::unique_ptr<ObjectFile<ELF64BE>>>,
|
||||
const SymbolBody *);
|
||||
|
|
|
@ -87,6 +87,11 @@ private:
|
|||
llvm::DenseSet<StringRef> IncludedSoNames;
|
||||
};
|
||||
|
||||
template <class ELFT>
|
||||
ELFFileBase<ELFT> *
|
||||
findFile(ArrayRef<std::unique_ptr<ObjectFile<ELFT>>> ObjectFiles,
|
||||
const SymbolBody *B);
|
||||
|
||||
} // namespace elf2
|
||||
} // namespace lld
|
||||
|
||||
|
|
|
@ -333,15 +333,7 @@ static void reportUndefined(const SymbolTable<ELFT> &S, const SymbolBody &Sym) {
|
|||
if (Config->Shared && !Config->NoUndefined)
|
||||
return;
|
||||
|
||||
const Elf_Sym &SymE = cast<ELFSymbolBody<ELFT>>(Sym).Sym;
|
||||
ELFFileBase<ELFT> *SymFile = nullptr;
|
||||
|
||||
for (const std::unique_ptr<ObjectFile<ELFT>> &File : S.getObjectFiles()) {
|
||||
Elf_Sym_Range Syms = File->getObj().symbols(File->getSymbolTable());
|
||||
if (&SymE > Syms.begin() && &SymE < Syms.end())
|
||||
SymFile = File.get();
|
||||
}
|
||||
|
||||
ELFFileBase<ELFT> *SymFile = findFile<ELFT>(S.getObjectFiles(), &Sym);
|
||||
std::string Message = "undefined symbol: " + Sym.getName().str();
|
||||
if (SymFile)
|
||||
Message += " in " + SymFile->getName().str();
|
||||
|
|
Loading…
Reference in New Issue