[all-commits] [llvm/llvm-project] 448ac7: [lldb][Mach-O] Handle shared cache binaries correc...

Jason Molenda via All-commits all-commits at lists.llvm.org
Thu Nov 28 10:32:19 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 448ac7d3418a31d35b462440c8bf644287efac8a
      https://github.com/llvm/llvm-project/commit/448ac7d3418a31d35b462440c8bf644287efac8a
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2024-11-28 (Thu, 28 Nov 2024)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h

  Log Message:
  -----------
  [lldb][Mach-O] Handle shared cache binaries correctly (#117832)

The Mach-O load commands have an LC_SYMTAB / struct symtab_command which
represents the offset of the symbol table (nlist records) and string
table for this binary. In a mach-o binary on disk, these are file
offsets. If a mach-o binary is loaded in memory with all segments
consecutive, the `symoff` and `stroff` are the offsets from the TEXT
segment (aka the mach-o header) virtual address to the virtual address
of the start of these tables.

However, if a Mach-O binary is a part of the shared cache, then the
segments will be separated -- they will have different slide values. And
it is possible for the LINKEDIT segment to be greater than 4GB away from
the TEXT segment in the virtual address space, so these 32-bit offsets
cannot express the offset from TEXT segment to these tables.

Create separate uint64_t variables to track the offset to the symbol
table and string table, instead of reusing the 32-bit ones in the
symtab_command structure.

rdar://140432279



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list