[llvm] [llvm-objdump][macho] Add support for ObjC relative method lists (PR #84250)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 11:45:10 PDT 2024


================
@@ -4440,8 +4473,103 @@ static void print_layout_map32(uint32_t p, struct DisassembleInfo *info) {
   print_layout_map(layout_map, left);
 }
 
+// Return true if this is a delta method list, false otherwise
+static bool print_method_list_delta_t(uint64_t p, struct DisassembleInfo *info,
+                                      const char *indent,
+                                      uint32_t pointerBits) {
+  struct method_list_delta_t ml;
+  struct method_delta_t m;
+  const char *r, *name;
+  uint32_t offset, xoffset, left, i;
+  SectionRef S, xS;
+
+  r = get_pointer_32(p, offset, left, S, info);
+  if (r == nullptr)
+    return false;
+  memset(&ml, '\0', sizeof(struct method_list_delta_t));
+  if (left < sizeof(struct method_list_delta_t)) {
+    memcpy(&ml, r, left);
+    outs() << "   (method_delta_t entends past the end of the section)\n";
----------------
kyulee-com wrote:

Perhaps the link to the open source is outdated, compared to the latest one in Xcode.
I played this following with the following tool:
```
$ objdump --version
Apple LLVM version 15.0.0
```
It prints with `extends`. which your latest code seems to already fix it.
```
            name    0x7ed0 (0x10000c090 extends past end of file)
```
In theory, I guess we shouldn't display the text `()` at all as it seems a valid region when using this encoding. But keeping the same behavior with Xcode's objdump seems okay.

https://github.com/llvm/llvm-project/pull/84250


More information about the llvm-commits mailing list