aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/XCOFFObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/XCOFFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/XCOFFObjectFile.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/llvm/lib/Object/XCOFFObjectFile.cpp b/llvm/lib/Object/XCOFFObjectFile.cpp
index fa4917e..4c192aa 100644
--- a/llvm/lib/Object/XCOFFObjectFile.cpp
+++ b/llvm/lib/Object/XCOFFObjectFile.cpp
@@ -689,6 +689,10 @@ basic_symbol_iterator XCOFFObjectFile::symbol_end() const {
return basic_symbol_iterator(SymbolRef(SymDRI, this));
}
+XCOFFObjectFile::xcoff_symbol_iterator_range XCOFFObjectFile::symbols() const {
+ return xcoff_symbol_iterator_range(symbol_begin(), symbol_end());
+}
+
section_iterator XCOFFObjectFile::section_begin() const {
DataRefImpl DRI;
DRI.p = getSectionHeaderTableAddress();
@@ -1248,7 +1252,7 @@ bool XCOFFSymbolRef::isFunction() const {
return false;
const int16_t SectNum = getSectionNumber();
- Expected<DataRefImpl> SI = OwningObjectPtr->getSectionByNum(SectNum);
+ Expected<DataRefImpl> SI = getObject()->getSectionByNum(SectNum);
if (!SI) {
// If we could not get the section, then this symbol should not be
// a function. So consume the error and return `false` to move on.
@@ -1256,7 +1260,7 @@ bool XCOFFSymbolRef::isFunction() const {
return false;
}
- return (OwningObjectPtr->getSectionFlags(SI.get()) & XCOFF::STYP_TEXT);
+ return (getObject()->getSectionFlags(SI.get()) & XCOFF::STYP_TEXT);
}
bool XCOFFSymbolRef::isCsectSymbol() const {
@@ -1275,13 +1279,13 @@ Expected<XCOFFCsectAuxRef> XCOFFSymbolRef::getXCOFFCsectAuxRef() const {
if (auto Err = NameOrErr.takeError())
return std::move(Err);
- uint32_t SymbolIdx = OwningObjectPtr->getSymbolIndex(getEntryAddress());
+ uint32_t SymbolIdx = getObject()->getSymbolIndex(getEntryAddress());
if (!NumberOfAuxEntries) {
return createError("csect symbol \"" + *NameOrErr + "\" with index " +
Twine(SymbolIdx) + " contains no auxiliary entry");
}
- if (!OwningObjectPtr->is64Bit()) {
+ if (!getObject()->is64Bit()) {
// In XCOFF32, the csect auxilliary entry is always the last auxiliary
// entry for the symbol.
uintptr_t AuxAddr = XCOFFObjectFile::getAdvancedSymbolEntryAddress(
@@ -1294,10 +1298,10 @@ Expected<XCOFFCsectAuxRef> XCOFFSymbolRef::getXCOFFCsectAuxRef() const {
for (uint8_t Index = NumberOfAuxEntries; Index > 0; --Index) {
uintptr_t AuxAddr = XCOFFObjectFile::getAdvancedSymbolEntryAddress(
getEntryAddress(), Index);
- if (*OwningObjectPtr->getSymbolAuxType(AuxAddr) ==
+ if (*getObject()->getSymbolAuxType(AuxAddr) ==
XCOFF::SymbolAuxType::AUX_CSECT) {
#ifndef NDEBUG
- OwningObjectPtr->checkSymbolEntryPointer(AuxAddr);
+ getObject()->checkSymbolEntryPointer(AuxAddr);
#endif
return XCOFFCsectAuxRef(viewAs<XCOFFCsectAuxEnt64>(AuxAddr));
}
@@ -1314,14 +1318,15 @@ Expected<StringRef> XCOFFSymbolRef::getName() const {
if (getStorageClass() & 0x80)
return StringRef("Unimplemented Debug Name");
- if (Entry32) {
- if (Entry32->NameInStrTbl.Magic != XCOFFSymbolRef::NAME_IN_STR_TBL_MAGIC)
- return generateXCOFFFixedNameStringRef(Entry32->SymbolName);
+ if (!getObject()->is64Bit()) {
+ if (getSymbol32()->NameInStrTbl.Magic !=
+ XCOFFSymbolRef::NAME_IN_STR_TBL_MAGIC)
+ return generateXCOFFFixedNameStringRef(getSymbol32()->SymbolName);
- return OwningObjectPtr->getStringTableEntry(Entry32->NameInStrTbl.Offset);
+ return getObject()->getStringTableEntry(getSymbol32()->NameInStrTbl.Offset);
}
- return OwningObjectPtr->getStringTableEntry(Entry64->Offset);
+ return getObject()->getStringTableEntry(getSymbol64()->Offset);
}
// Explictly instantiate template classes.