[PATCH] D124920: [llvm-otool] Make `llvm-otool -l` output compatible with otool for LC_BUILD_VERSION
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 4 16:19:35 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGddef1ed4e793: [llvm-otool] Make `llvm-otool -l` output compatible with otool for… (authored by thakis).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124920/new/
https://reviews.llvm.org/D124920
Files:
llvm/test/tools/llvm-objdump/MachO/build-version.yaml
llvm/tools/llvm-objdump/MachODump.cpp
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);
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124920.427160.patch
Type: text/x-patch
Size: 3160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220504/673c562e/attachment.bin>
More information about the llvm-commits
mailing list