diff options
Diffstat (limited to 'tools/obj2yaml/macho2yaml.cpp')
-rw-r--r-- | tools/obj2yaml/macho2yaml.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/obj2yaml/macho2yaml.cpp b/tools/obj2yaml/macho2yaml.cpp index 0c30dc7575ec..9ad2a6d979f5 100644 --- a/tools/obj2yaml/macho2yaml.cpp +++ b/tools/obj2yaml/macho2yaml.cpp @@ -163,6 +163,23 @@ const char *MachODumper::processLoadCommandData<MachO::rpath_command>( return readString<MachO::rpath_command>(LC, LoadCmd); } +template <> +const char *MachODumper::processLoadCommandData<MachO::build_version_command>( + MachOYAML::LoadCommand &LC, + const llvm::object::MachOObjectFile::LoadCommandInfo &LoadCmd) { + auto Start = LoadCmd.Ptr + sizeof(MachO::build_version_command); + auto NTools = LC.Data.build_version_command_data.ntools; + for (unsigned i = 0; i < NTools; ++i) { + auto Curr = Start + i * sizeof(MachO::build_tool_version); + MachO::build_tool_version BV; + memcpy((void *)&BV, Curr, sizeof(MachO::build_tool_version)); + if (Obj.isLittleEndian() != sys::IsLittleEndianHost) + MachO::swapStruct(BV); + LC.Tools.push_back(BV); + } + return Start + NTools * sizeof(MachO::build_tool_version); +} + Expected<std::unique_ptr<MachOYAML::Object>> MachODumper::dump() { auto Y = make_unique<MachOYAML::Object>(); Y->IsLittleEndian = Obj.isLittleEndian(); |