mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-25 04:35:32 -04:00
[llvm-readobj] [COFF] Print the symbol index for relocations
There can be multiple local symbols with the same name (for e.g. comdat sections), and thus the symbol name itself isn't enough to disambiguate symbols. Differential Revision: https://reviews.llvm.org/D56140 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350288 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1065,6 +1065,16 @@ COFFObjectFile::getSymbolAuxData(COFFSymbolRef Symbol) const {
|
||||
return makeArrayRef(Aux, Symbol.getNumberOfAuxSymbols() * SymbolSize);
|
||||
}
|
||||
|
||||
uint32_t COFFObjectFile::getSymbolIndex(COFFSymbolRef Symbol) const {
|
||||
uintptr_t Offset =
|
||||
reinterpret_cast<uintptr_t>(Symbol.getRawPtr()) - getSymbolTable();
|
||||
assert(Offset % getSymbolTableEntrySize() == 0 &&
|
||||
"Symbol did not point to the beginning of a symbol");
|
||||
size_t Index = Offset / getSymbolTableEntrySize();
|
||||
assert(Index < getNumberOfSymbols());
|
||||
return Index;
|
||||
}
|
||||
|
||||
std::error_code COFFObjectFile::getSectionName(const coff_section *Sec,
|
||||
StringRef &Res) const {
|
||||
StringRef Name;
|
||||
|
||||
Reference in New Issue
Block a user