aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r--llvm/lib/Object/MachOObjectFile.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 909a4cf..85f3824 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -1303,7 +1303,6 @@ MachOObjectFile::MachOObjectFile(MemoryBufferRef Object, bool IsLittleEndian,
}
const char *DyldIdLoadCmd = nullptr;
- const char *FuncStartsLoadCmd = nullptr;
const char *SplitInfoLoadCmd = nullptr;
const char *CodeSignDrsLoadCmd = nullptr;
const char *CodeSignLoadCmd = nullptr;
@@ -4663,6 +4662,21 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoExportsTrie() const {
return makeArrayRef(Ptr, DyldInfo.export_size);
}
+SmallVector<uint64_t> MachOObjectFile::getFunctionStarts() const {
+ if (!FuncStartsLoadCmd)
+ return {};
+
+ auto InfoOrErr =
+ getStructOrErr<MachO::linkedit_data_command>(*this, FuncStartsLoadCmd);
+ if (!InfoOrErr)
+ return {};
+
+ MachO::linkedit_data_command Info = InfoOrErr.get();
+ SmallVector<uint64_t, 8> FunctionStarts;
+ this->ReadULEB128s(Info.dataoff, FunctionStarts);
+ return std::move(FunctionStarts);
+}
+
ArrayRef<uint8_t> MachOObjectFile::getUuid() const {
if (!UuidLoadCmd)
return None;