[all-commits] [llvm/llvm-project] f9759d: Prioritize using a segment with the name TEXT inst...

Jason Molenda via All-commits all-commits at lists.llvm.org
Wed May 10 16:42:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f9759d0cb6dc19aa67dbe1c3d56404041f8b4c7e
      https://github.com/llvm/llvm-project/commit/f9759d0cb6dc19aa67dbe1c3d56404041f8b4c7e
  Author: Jason Molenda <jason at molenda.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

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

  Log Message:
  -----------
  Prioritize using a segment with the name TEXT instead off fileoff 0

lldb needs to find the virtual address of the mach header of a
binary.  It first scans for a segment which starts at file offset
0, and uses the vmaddr of that segment.  If no segment starts at
fileoff 0, it looks for a segment named __TEXT.

This patch changes the order of those, to first search for the TEXT
segment.  We have a situation where binaries exist that have the
DATA segment first, which does not have the vmaddr of the mach header,
it merely happens to come first in the binary file.  It's an unusual
arrangement, but not breaking any rules of Mach-O.  So lldb needs
to handle this.

Differential Revision: https://reviews.llvm.org/D150239
rdar://109128418




More information about the All-commits mailing list