diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
commit | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch) | |
tree | 5343938942df402b49ec7300a1c25a2d4ccd5821 /tools/obj2yaml/macho2yaml.cpp | |
parent | 31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff) |
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(); |