aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Object/XCOFFObjectFile.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-07-27 23:34:35 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-10-23 18:26:01 +0000
commit0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583 (patch)
tree6cf5ab1f05330c6773b1f3f64799d56a9c7a1faa /contrib/llvm-project/llvm/lib/Object/XCOFFObjectFile.cpp
parent6b9f7133aba44189d9625c352bc2c2a59baf18ef (diff)
parentac9a064cb179f3425b310fa2847f8764ac970a4d (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Object/XCOFFObjectFile.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Object/XCOFFObjectFile.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/contrib/llvm-project/llvm/lib/Object/XCOFFObjectFile.cpp b/contrib/llvm-project/llvm/lib/Object/XCOFFObjectFile.cpp
index 3fbd51887831..6efb8759d13f 100644
--- a/contrib/llvm-project/llvm/lib/Object/XCOFFObjectFile.cpp
+++ b/contrib/llvm-project/llvm/lib/Object/XCOFFObjectFile.cpp
@@ -65,6 +65,12 @@ template <typename T> uint16_t XCOFFSectionHeader<T>::getSectionType() const {
}
template <typename T>
+uint32_t XCOFFSectionHeader<T>::getSectionSubtype() const {
+ const T &DerivedXCOFFSectionHeader = static_cast<const T &>(*this);
+ return DerivedXCOFFSectionHeader.Flags & ~SectionFlagsTypeMask;
+}
+
+template <typename T>
bool XCOFFSectionHeader<T>::isReservedSectionType() const {
return getSectionType() & SectionFlagsReservedMask;
}
@@ -731,9 +737,11 @@ bool XCOFFObjectFile::isRelocatableObject() const {
}
Expected<uint64_t> XCOFFObjectFile::getStartAddress() const {
- // TODO FIXME Should get from auxiliary_header->o_entry when support for the
- // auxiliary_header is added.
- return 0;
+ if (AuxiliaryHeader == nullptr)
+ return 0;
+
+ return is64Bit() ? auxiliaryHeader64()->getEntryPointAddr()
+ : auxiliaryHeader32()->getEntryPointAddr();
}
StringRef XCOFFObjectFile::mapDebugSectionName(StringRef Name) const {
@@ -1361,7 +1369,7 @@ Expected<StringRef> XCOFFSymbolRef::getName() const {
return getObject()->getStringTableEntry(getSymbol64()->Offset);
}
-// Explictly instantiate template classes.
+// Explicitly instantiate template classes.
template struct XCOFFSectionHeader<XCOFFSectionHeader32>;
template struct XCOFFSectionHeader<XCOFFSectionHeader64>;