mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-28 23:43:25 +00:00
[readobj] Move dynamic table parsing to a new function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260487 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
71498d2261
commit
c2545ee719
@ -112,6 +112,8 @@ private:
|
|||||||
uintX_t EntSize;
|
uintX_t EntSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void parseDynamicTable(ArrayRef<const Elf_Phdr *> LoadSegments);
|
||||||
|
|
||||||
void printSymbolsHelper(bool IsDynamic);
|
void printSymbolsHelper(bool IsDynamic);
|
||||||
void printSymbol(const Elf_Sym *Symbol, const Elf_Shdr *SymTab,
|
void printSymbol(const Elf_Sym *Symbol, const Elf_Shdr *SymTab,
|
||||||
StringRef StrTable, bool IsDynamic);
|
StringRef StrTable, bool IsDynamic);
|
||||||
@ -1032,8 +1034,19 @@ ELFDumper<ELFT>::ELFDumper(const ELFFile<ELFT> *Obj, StreamWriter &Writer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parseDynamicTable(LoadSegments);
|
||||||
|
|
||||||
|
if (opts::Output == opts::GNU)
|
||||||
|
ELFDumperStyle.reset(new GNUStyle<ELFT>(Writer));
|
||||||
|
else
|
||||||
|
ELFDumperStyle.reset(new LLVMStyle<ELFT>(Writer));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename ELFT>
|
||||||
|
void ELFDumper<ELFT>::parseDynamicTable(
|
||||||
|
ArrayRef<const Elf_Phdr *> LoadSegments) {
|
||||||
auto toMappedAddr = [&](uint64_t VAddr) -> const uint8_t * {
|
auto toMappedAddr = [&](uint64_t VAddr) -> const uint8_t * {
|
||||||
const Elf_Phdr **I = std::upper_bound(
|
const Elf_Phdr *const *I = std::upper_bound(
|
||||||
LoadSegments.begin(), LoadSegments.end(), VAddr, compareAddr<ELFT>);
|
LoadSegments.begin(), LoadSegments.end(), VAddr, compareAddr<ELFT>);
|
||||||
if (I == LoadSegments.begin())
|
if (I == LoadSegments.begin())
|
||||||
report_fatal_error("Virtual address is not in any segment");
|
report_fatal_error("Virtual address is not in any segment");
|
||||||
@ -1095,10 +1108,6 @@ ELFDumper<ELFT>::ELFDumper(const ELFFile<ELFT> *Obj, StreamWriter &Writer)
|
|||||||
DynamicStringTable = StringRef(StringTableBegin, StringTableSize);
|
DynamicStringTable = StringRef(StringTableBegin, StringTableSize);
|
||||||
if (SONameOffset)
|
if (SONameOffset)
|
||||||
SOName = getDynamicString(SONameOffset);
|
SOName = getDynamicString(SONameOffset);
|
||||||
if (opts::Output == opts::GNU)
|
|
||||||
ELFDumperStyle.reset(new GNUStyle<ELFT>(Writer));
|
|
||||||
else
|
|
||||||
ELFDumperStyle.reset(new LLVMStyle<ELFT>(Writer));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ELFT>
|
template <typename ELFT>
|
||||||
|
Loading…
Reference in New Issue
Block a user