mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 07:39:31 +00:00
Remove MachOObjectFile::getObject.
llvm-svn: 178986
This commit is contained in:
parent
04cc447824
commit
fcd60f68e0
@ -161,8 +161,9 @@ public:
|
||||
const MachOFormat::SymbolTableEntry *
|
||||
getSymbolTableEntry(DataRefImpl DRI) const;
|
||||
bool is64Bit() const;
|
||||
|
||||
const MachOObject *getObject() const { return MachOObj.get(); }
|
||||
const LoadCommandInfo &getLoadCommandInfo(unsigned Index) const;
|
||||
void ReadULEB128s(uint64_t Index, SmallVectorImpl<uint64_t> &Out) const;
|
||||
const macho::Header &getHeader() const;
|
||||
|
||||
static inline bool classof(const Binary *v) {
|
||||
return v->isMachO();
|
||||
|
@ -45,6 +45,20 @@ bool MachOObjectFile::is64Bit() const {
|
||||
return MachOObj->is64Bit();
|
||||
}
|
||||
|
||||
const LoadCommandInfo &
|
||||
MachOObjectFile::getLoadCommandInfo(unsigned Index) const {
|
||||
return MachOObj->getLoadCommandInfo(Index);
|
||||
}
|
||||
|
||||
void MachOObjectFile::ReadULEB128s(uint64_t Index,
|
||||
SmallVectorImpl<uint64_t> &Out) const {
|
||||
return MachOObj->ReadULEB128s(Index, Out);
|
||||
}
|
||||
|
||||
const macho::Header &MachOObjectFile::getHeader() const {
|
||||
return MachOObj->getHeader();
|
||||
}
|
||||
|
||||
ObjectFile *ObjectFile::createMachOObjectFile(MemoryBuffer *Buffer) {
|
||||
error_code ec;
|
||||
std::string Err;
|
||||
|
@ -52,7 +52,7 @@ static cl::opt<bool>
|
||||
static cl::opt<std::string>
|
||||
DSYMFile("dsym", cl::desc("Use .dSYM file for debug info"));
|
||||
|
||||
static const Target *GetTarget(const MachOObject *MachOObj) {
|
||||
static const Target *GetTarget(const MachOObjectFile *MachOObj) {
|
||||
// Figure out the target triple.
|
||||
if (TripleName.empty()) {
|
||||
llvm::Triple TT("unknown-unknown-unknown");
|
||||
@ -108,7 +108,7 @@ struct SymbolSorter {
|
||||
|
||||
// Print additional information about an address, if available.
|
||||
static void DumpAddress(uint64_t Address, ArrayRef<SectionRef> Sections,
|
||||
const MachOObject *MachOObj, raw_ostream &OS) {
|
||||
const MachOObjectFile *MachOObj, raw_ostream &OS) {
|
||||
for (unsigned i = 0; i != Sections.size(); ++i) {
|
||||
uint64_t SectAddr = 0, SectSize = 0;
|
||||
Sections[i].getAddress(SectAddr);
|
||||
@ -218,15 +218,14 @@ static void getSectionsAndSymbols(const macho::Header &Header,
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i != Header.NumLoadCommands; ++i) {
|
||||
const MachOObject::LoadCommandInfo &LCI =
|
||||
MachOObj->getObject()->getLoadCommandInfo(i);
|
||||
const MachOObject::LoadCommandInfo &LCI = MachOObj->getLoadCommandInfo(i);
|
||||
if (LCI.Command.Type == macho::LCT_FunctionStarts) {
|
||||
// We found a function starts segment, parse the addresses for later
|
||||
// consumption.
|
||||
const MachOFormat::LinkeditDataLoadCommand *LLC =
|
||||
MachOObj->getLinkeditDataLoadCommand(LCI);
|
||||
|
||||
MachOObj->getObject()->ReadULEB128s(LLC->DataOffset, FoundFns);
|
||||
MachOObj->ReadULEB128s(LLC->DataOffset, FoundFns);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -241,9 +240,8 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
|
||||
|
||||
OwningPtr<MachOObjectFile> MachOOF(static_cast<MachOObjectFile*>(
|
||||
ObjectFile::createMachOObjectFile(Buff.take())));
|
||||
const MachOObject *MachOObj = MachOOF->getObject();
|
||||
|
||||
const Target *TheTarget = GetTarget(MachOObj);
|
||||
const Target *TheTarget = GetTarget(MachOOF.get());
|
||||
if (!TheTarget) {
|
||||
// GetTarget prints out stuff.
|
||||
return;
|
||||
@ -271,7 +269,7 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
|
||||
|
||||
outs() << '\n' << Filename << ":\n\n";
|
||||
|
||||
const macho::Header &Header = MachOObj->getHeader();
|
||||
const macho::Header &Header = MachOOF->getHeader();
|
||||
|
||||
std::vector<SectionRef> Sections;
|
||||
std::vector<SymbolRef> Symbols;
|
||||
@ -580,7 +578,7 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
|
||||
Relocs[j].second.getName(SymName);
|
||||
|
||||
outs() << "\t# " << SymName << ' ';
|
||||
DumpAddress(Addr, Sections, MachOObj, outs());
|
||||
DumpAddress(Addr, Sections, MachOOF.get(), outs());
|
||||
}
|
||||
|
||||
// If this instructions contains an address, see if we can evaluate
|
||||
@ -589,7 +587,7 @@ void llvm::DisassembleInputMachO(StringRef Filename) {
|
||||
Inst.Address,
|
||||
Inst.Size);
|
||||
if (targ != -1ULL)
|
||||
DumpAddress(targ, Sections, MachOObj, outs());
|
||||
DumpAddress(targ, Sections, MachOOF.get(), outs());
|
||||
|
||||
// Print debug info.
|
||||
if (diContext) {
|
||||
|
Loading…
Reference in New Issue
Block a user