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