support::ulittle32_t NumSections;
support::ulittle32_t Flags;
};
+
+ struct LinkeditDataLoadCommand {
+ support::ulittle32_t Type;
+ support::ulittle32_t Size;
+ support::ulittle32_t DataOffset;
+ support::ulittle32_t DataSize;
+ };
}
typedef MachOObject::LoadCommandInfo LoadCommandInfo;
ArrayRef<char> getSectionRawName(DataRefImpl Sec) const;
ArrayRef<char>getSectionRawFinalSegmentName(DataRefImpl Sec) const;
+ const MachOFormat::LinkeditDataLoadCommand *
+ getLinkeditDataLoadCommand(LoadCommandInfo LCI) const;
+
MachOObject *getObject() { return MachOObj.get(); }
static inline bool classof(const Binary *v) {
return reinterpret_cast<const MachOFormat::SegmentLoadCommand*>(Data.data());
}
+const MachOFormat::LinkeditDataLoadCommand *
+MachOObjectFile::getLinkeditDataLoadCommand(LoadCommandInfo LCI) const {
+ StringRef Data = MachOObj->getData(LCI.Offset,
+ sizeof(MachOFormat::LinkeditDataLoadCommand));
+ return
+ reinterpret_cast<const MachOFormat::LinkeditDataLoadCommand*>(Data.data());
+}
+
const MachOFormat::Segment64LoadCommand *
MachOObjectFile::getSegment64LoadCommand(LoadCommandInfo LCI) const {
StringRef Data = MachOObj->getData(LCI.Offset,
if (LCI.Command.Type == macho::LCT_FunctionStarts) {
// We found a function starts segment, parse the addresses for later
// consumption.
- InMemoryStruct<macho::LinkeditDataLoadCommand> LLC;
- MachOObj->getObject()->ReadLinkeditDataLoadCommand(LCI, LLC);
+ const MachOFormat::LinkeditDataLoadCommand *LLC =
+ MachOObj->getLinkeditDataLoadCommand(LCI);
MachOObj->getObject()->ReadULEB128s(LLC->DataOffset, FoundFns);
}