summaryrefslogtreecommitdiffstats
path: root/llvm/tools/obj2yaml/macho2yaml.cpp
diff options
context:
space:
mode:
authorSteven Wu <stevenwu@apple.com>2017-01-23 20:07:55 +0000
committerSteven Wu <stevenwu@apple.com>2017-01-23 20:07:55 +0000
commit5b54a42c0f1178dbb367866f92cd4efe88710bd6 (patch)
tree55464f3be2aa42cdf522652eb39e7969d85a5c24 /llvm/tools/obj2yaml/macho2yaml.cpp
parentcddeb751a11ce5771bedaa36f04775fb0aa56212 (diff)
downloadbcm5719-llvm-5b54a42c0f1178dbb367866f92cd4efe88710bd6.tar.gz
bcm5719-llvm-5b54a42c0f1178dbb367866f92cd4efe88710bd6.zip
Add LC_BUILD_VERSION load command
Summary: Add a new load command LC_BUILD_VERSION. It is a generic version of LC_*_VERSION_MIN load_command used on Apple platforms. Instead of having a seperate load command for each platform, LC_BUILD_VERSION is recording platform info as an enum. It also records SDK version, min_os, and tools that used to build the binary. rdar://problem/29781291 Reviewers: enderby Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29044 llvm-svn: 292824
Diffstat (limited to 'llvm/tools/obj2yaml/macho2yaml.cpp')
-rw-r--r--llvm/tools/obj2yaml/macho2yaml.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/tools/obj2yaml/macho2yaml.cpp b/llvm/tools/obj2yaml/macho2yaml.cpp
index 0c30dc7575e..9ad2a6d979f 100644
--- a/llvm/tools/obj2yaml/macho2yaml.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud