Index: tools/llvm-readobj/MachODumper.cpp =================================================================== --- tools/llvm-readobj/MachODumper.cpp +++ tools/llvm-readobj/MachODumper.cpp @@ -205,7 +205,27 @@ } void MachODumper::printFileHeaders() { - W.startLine() << "FileHeaders not implemented.\n"; + DictScope H(W, "MachHeader"); + if (!Obj->is64Bit()) { + const MachO::mach_header Header = Obj->getHeader(); + W.printHex("Magic", Header.magic); + W.printNumber("CpuType", Header.cputype); + W.printNumber("CpuSubtype", Header.cpusubtype); + W.printNumber("FileType", Header.filetype); + W.printNumber("NumOfCommands", Header.ncmds); + W.printNumber("SizeOfCommands", Header.sizeofcmds); + W.printHex("Flags", Header.flags); + } else { + const MachO::mach_header_64 Header64 = Obj->getHeader64(); + W.printHex("Magic", Header64.magic); + W.printNumber("CpuType", Header64.cputype); + W.printNumber("CpuSubtype", Header64.cpusubtype); + W.printNumber("FileType", Header64.filetype); + W.printNumber("NumOfCommands", Header64.ncmds); + W.printNumber("SizeOfCommands", Header64.sizeofcmds); + W.printHex("Flags", Header64.flags); + W.printHex("Reserved", Header64.reserved); + } } void MachODumper::printSections() {