[llvm] b9d63e1 - [llvm-otool] Print dyld_info output before chained_fixup output

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 08:03:52 PDT 2022


Author: Nico Weber
Date: 2022-08-30T11:03:30-04:00
New Revision: b9d63e10b9cfc78f5248a47fed51035c6b320c5c

URL: https://github.com/llvm/llvm-project/commit/b9d63e10b9cfc78f5248a47fed51035c6b320c5c
DIFF: https://github.com/llvm/llvm-project/commit/b9d63e10b9cfc78f5248a47fed51035c6b320c5c.diff

LOG: [llvm-otool] Print dyld_info output before chained_fixup output

This matches otool.

Differential Revision: https://reviews.llvm.org/D132865

Added: 
    

Modified: 
    llvm/test/tools/llvm-objdump/MachO/dyld-info.test
    llvm/tools/llvm-objdump/MachODump.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-objdump/MachO/dyld-info.test b/llvm/test/tools/llvm-objdump/MachO/dyld-info.test
index 20a08b9f2c465..a3c11e660d44a 100644
--- a/llvm/test/tools/llvm-objdump/MachO/dyld-info.test
+++ b/llvm/test/tools/llvm-objdump/MachO/dyld-info.test
@@ -3,7 +3,6 @@ RUN:     FileCheck -DNAME=%p/Inputs/chained-fixups.macho-x86_64 %s
 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  0x1410  0x8000000000000003 bind   0x0     weak
 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

diff  --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp
index c0820380fff8f..1146d36f5da29 100644
--- a/llvm/tools/llvm-objdump/MachODump.cpp
+++ b/llvm/tools/llvm-objdump/MachODump.cpp
@@ -2182,10 +2182,10 @@ static void ProcessMachO(StringRef Name, MachOObjectFile *MachOOF,
     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)


        


More information about the llvm-commits mailing list