[PATCH] D132865: [llvm-otool] Print dyld_info output before chained_fixup output

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 09:41:10 PDT 2022


thakis created this revision.
thakis added a reviewer: BertalanD.
Herald added a subscriber: rupprecht.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
Herald added a reviewer: ributzka.
Herald added a project: All.
thakis requested review of this revision.
Herald added a subscriber: StephenFan.
Herald added a project: LLVM.

This matches otool.


https://reviews.llvm.org/D132865

Files:
  llvm/test/tools/llvm-objdump/MachO/dyld-info.test
  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
@@ -2182,10 +2182,10 @@
     DumpSectionContents(FileName, MachOOF, Verbose);
   if (InfoPlist)
     DumpInfoPlistSectionContents(FileName, MachOOF);
-  if (ChainedFixups)
-    PrintChainedFixups(MachOOF);
   if (DyldInfo)
     PrintDyldInfo(MachOOF);
+  if (ChainedFixups)
+    PrintChainedFixups(MachOOF);
   if (DylibsUsed)
     PrintDylibs(MachOOF, false);
   if (DylibId)
Index: llvm/test/tools/llvm-objdump/MachO/dyld-info.test
===================================================================
--- llvm/test/tools/llvm-objdump/MachO/dyld-info.test
+++ llvm/test/tools/llvm-objdump/MachO/dyld-info.test
@@ -3,7 +3,6 @@
 RUN: llvm-otool -dyld_info %p/Inputs/chained-fixups.macho-x86_64 | \
 RUN:     FileCheck -DNAME=%p/Inputs/chained-fixups.macho-x86_64 %s
 
-
 ## See chained-fixups.test for how the test input was generated.
 CHECK:      [[NAME]]:
 CHECK-NEXT: dyld information:
@@ -16,7 +15,17 @@
 CHECK-NEXT: __DATA       __data  0x3410  0x8010000000000002 bind   0x0     libdylib      _dylib
 CHECK-NEXT: __DATA       __data  0x3418  0x800000002A000002 bind   0x2A    libdylib      _dylib
 
+
 ## TODO: Print opcode-based fixups/binds as well
 ## For now, test that execution doesn't fail if the input uses those.
 RUN: llvm-objdump --macho --dyld-info %p/Inputs/bind.macho-x86_64
 RUN: llvm-objdump --macho --dyld-info %p/Inputs/bind.macho-x86_64
+
+
+## If both -chained_fixups and -dyld_info are passed, otool prints dyld_info
+## output first. Match that.
+RUN: llvm-otool -chained_fixups -dyld_info \
+RUN:     %p/Inputs/chained-fixups.macho-x86_64 | \
+RUN:     FileCheck --check-prefix=BOTH %s
+BOTH: dyld information:
+BOTH: chained fixups header


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132865.456385.patch
Type: text/x-patch
Size: 1864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220829/11602c8e/attachment.bin>


More information about the llvm-commits mailing list