Index: llvm/test/tools/llvm-objdump/MachO/build-version.yaml =================================================================== --- llvm/test/tools/llvm-objdump/MachO/build-version.yaml +++ llvm/test/tools/llvm-objdump/MachO/build-version.yaml @@ -1,4 +1,6 @@ # RUN: yaml2obj %s | llvm-objdump --macho --private-headers - | FileCheck %s +# RUN: yaml2obj %s | llvm-otool -lv - | FileCheck %s +# RUN: yaml2obj %s | llvm-otool -l - | FileCheck --check-prefix=SHORT %s --- !mach-o FileHeader: @@ -55,3 +57,13 @@ CHECK-NEXT: ntools 1 CHECK-NEXT: tool clang CHECK-NEXT: version 0.0 + +SHORT: Load command 1 +SHORT-NEXT: cmd LC_BUILD_VERSION +SHORT-NEXT: cmdsize 32 +SHORT-NEXT: platform 2 +SHORT-NEXT: sdk 9.0 +SHORT-NEXT: minos 8.0 +SHORT-NEXT: ntools 1 +SHORT-NEXT: tool 1 +SHORT-NEXT: version 0.0 Index: llvm/tools/llvm-objdump/MachODump.cpp =================================================================== --- llvm/tools/llvm-objdump/MachODump.cpp +++ llvm/tools/llvm-objdump/MachODump.cpp @@ -9163,14 +9163,20 @@ outs() << " size " << Nt.size << "\n"; } -static void PrintBuildToolVersion(MachO::build_tool_version bv) { - outs() << " tool " << MachOObjectFile::getBuildTool(bv.tool) << "\n"; +static void PrintBuildToolVersion(MachO::build_tool_version bv, bool verbose) { + outs() << " tool "; + if (verbose) + outs() << MachOObjectFile::getBuildTool(bv.tool); + else + outs() << bv.tool; + outs() << "\n"; outs() << " version " << MachOObjectFile::getVersionString(bv.version) << "\n"; } static void PrintBuildVersionLoadCommand(const MachOObjectFile *obj, - MachO::build_version_command bd) { + MachO::build_version_command bd, + bool verbose) { outs() << " cmd LC_BUILD_VERSION\n"; outs() << " cmdsize " << bd.cmdsize; if (bd.cmdsize != @@ -9179,8 +9185,12 @@ outs() << " Incorrect size\n"; else outs() << "\n"; - outs() << " platform " << MachOObjectFile::getBuildPlatform(bd.platform) - << "\n"; + outs() << " platform "; + if (verbose) + outs() << MachOObjectFile::getBuildPlatform(bd.platform); + else + outs() << bd.platform; + outs() << "\n"; if (bd.sdk) outs() << " sdk " << MachOObjectFile::getVersionString(bd.sdk) << "\n"; @@ -9191,7 +9201,7 @@ outs() << " ntools " << bd.ntools << "\n"; for (unsigned i = 0; i < bd.ntools; ++i) { MachO::build_tool_version bv = obj->getBuildToolVersion(i); - PrintBuildToolVersion(bv); + PrintBuildToolVersion(bv, verbose); } } @@ -10168,7 +10178,7 @@ } else if (Command.C.cmd == MachO::LC_BUILD_VERSION) { MachO::build_version_command Bv = Obj->getBuildVersionLoadCommand(Command); - PrintBuildVersionLoadCommand(Obj, Bv); + PrintBuildVersionLoadCommand(Obj, Bv, verbose); } else if (Command.C.cmd == MachO::LC_SOURCE_VERSION) { MachO::source_version_command Sd = Obj->getSourceVersionCommand(Command); PrintSourceVersionCommand(Sd);