#include "ObjDumper.h"
#include "StackMapPrinter.h"
#include "llvm-readobj.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ScopedPrinter.h"
usingnamespacellvm;
usingnamespaceobject;
namespace {
class MachODumper : public ObjDumper { … };
}
namespace llvm {
std::unique_ptr<ObjDumper> createMachODumper(const object::MachOObjectFile &Obj,
ScopedPrinter &Writer) { … }
}
const EnumEntry<uint32_t> MachOMagics[] = …;
const EnumEntry<uint32_t> MachOHeaderFileTypes[] = …;
const EnumEntry<uint32_t> MachOHeaderCpuTypes[] = …;
const EnumEntry<uint32_t> MachOHeaderCpuSubtypesX86[] = …;
const EnumEntry<uint32_t> MachOHeaderCpuSubtypesX64[] = …;
const EnumEntry<uint32_t> MachOHeaderCpuSubtypesARM[] = …;
const EnumEntry<uint32_t> MachOHeaderCpuSubtypesARM64[] = …;
const EnumEntry<uint32_t> MachOHeaderCpuSubtypesSPARC[] = …;
const EnumEntry<uint32_t> MachOHeaderCpuSubtypesPPC[] = …;
const EnumEntry<uint32_t> MachOHeaderFlags[] = …;
const EnumEntry<unsigned> MachOSectionTypes[] = …;
const EnumEntry<unsigned> MachOSectionAttributes[] = …;
const EnumEntry<unsigned> MachOSymbolRefTypes[] = …;
const EnumEntry<unsigned> MachOSymbolFlags[] = …;
const EnumEntry<unsigned> MachOSymbolTypes[] = …;
namespace {
struct MachOSection { … };
struct MachOSegment { … };
struct MachOSymbol { … };
}
static std::string getMask(uint32_t prot)
{ … }
static void getSection(const MachOObjectFile *Obj,
DataRefImpl Sec,
MachOSection &Section) { … }
static void getSegment(const MachOObjectFile *Obj,
const MachOObjectFile::LoadCommandInfo &L,
MachOSegment &Segment) { … }
static void getSymbol(const MachOObjectFile *Obj,
DataRefImpl DRI,
MachOSymbol &Symbol) { … }
void MachODumper::printFileHeaders() { … }
template<class MachHeader>
void MachODumper::printFileHeaders(const MachHeader &Header) { … }
void MachODumper::printSectionHeaders() { … }
void MachODumper::printSectionHeaders(const MachOObjectFile *Obj) { … }
void MachODumper::printRelocations() { … }
void MachODumper::printRelocation(const RelocationRef &Reloc) { … }
void MachODumper::printRelocation(const MachOObjectFile *Obj,
const RelocationRef &Reloc) { … }
StringRef MachODumper::getSymbolName(const SymbolRef &Symbol) const { … }
uint8_t MachODumper::getSymbolType(const SymbolRef &Symbol) const { … }
bool MachODumper::compareSymbolsByName(SymbolRef LHS, SymbolRef RHS) const { … }
bool MachODumper::compareSymbolsByType(SymbolRef LHS, SymbolRef RHS) const { … }
void MachODumper::printSymbols(bool ) { … }
void MachODumper::printSymbols(std::optional<SymbolComparator> SymComp) { … }
void MachODumper::printDynamicSymbols() { … }
void MachODumper::printDynamicSymbols(std::optional<SymbolComparator> SymComp) { … }
void MachODumper::printSymbol(const SymbolRef &Symbol) { … }
void MachODumper::printSymbol(const SymbolRef &Symbol, ScopedPrinter &W) { … }
void MachODumper::printUnwindInfo() { … }
void MachODumper::printStackMap() const { … }
void MachODumper::printCGProfile() { … }
void MachODumper::printNeededLibraries() { … }
void MachODumper::printMachODataInCode() { … }
void MachODumper::printMachOVersionMin() { … }
void MachODumper::printMachODysymtab() { … }
void MachODumper::printMachOSegment() { … }
void MachODumper::printMachOIndirectSymbols() { … }
void MachODumper::printMachOLinkerOptions() { … }