[PATCH] D132036: [llvm-objdump] Add -dyld_info to llvm-otool

Daniel Bertalan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 01:08:50 PDT 2022


BertalanD added inline comments.


================
Comment at: llvm/lib/Object/MachOObjectFile.cpp:3390-3392
+  auto Field = [this](uint8_t Right, uint8_t Count) {
+    return (RawValue & ((1ull << Count) - 1) << Right) >> Right;
+  };
----------------
reminder to self: simplify this with `maskTrailingOnes`.


================
Comment at: llvm/test/tools/llvm-objdump/MachO/dyld-info.test:10-16
+CHECK-NEXT: __DATA_CONST __const 0x{{0*}}3E0   0x8010000000000001 bind   0x{{0*}}0      libdylib       _weakImport (weak import)
+CHECK-NEXT: __DATA_CONST __const 0x{{0*}}3E8   0x8000000000000000 bind   0x{{0*}}0      flat-namespace _dynamicLookup
+CHECK-NEXT: __DATA       __data  0x{{0*}}3F0   0x00200000000003F0 rebase                               0x{{0*}}3F0
+CHECK-NEXT: __DATA       __data  0x{{0*}}400   0x8000000000000004 bind   0x{{0*}}0      weak           _weak
+CHECK-NEXT: __DATA       __data  0x{{0*}}1410  0x8000000000000003 bind   0x{{0*}}0      weak           _weakLocal
+CHECK-NEXT: __DATA       __data  0x{{0*}}3410  0x8010000000000002 bind   0x{{0*}}0      libdylib       _dylib
+CHECK-NEXT: __DATA       __data  0x{{0*}}3418  0x800000002A000002 bind   0x{{0*}}2A     libdylib       _dylib
----------------
All the `{{0*}}` are a bit awkward, but I want this test to pass with cctools `otool` as well. It has a bunch of extra logic in the printing code to use the width of the largest number, while this patch always uses a fixed width; so the test needs to accept an arbitrary number of leading zeros.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132036/new/

https://reviews.llvm.org/D132036



More information about the llvm-commits mailing list