[all-commits] [llvm/llvm-project] 91c0ef: [lldb] [ObjectFileMachO] BSS segments are loadable...

Jason Molenda via All-commits all-commits at lists.llvm.org
Mon Jul 1 21:56:54 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 91c0ef6f67821eb7298cb05988045e92354ac77b
      https://github.com/llvm/llvm-project/commit/91c0ef6f67821eb7298cb05988045e92354ac77b
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2024-07-01 (Mon, 01 Jul 2024)

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

  Log Message:
  -----------
  [lldb] [ObjectFileMachO] BSS segments are loadable segments (#96983)

ObjectFileMachO::SetLoadAddress sets the address of each segment in a
binary in a Target, but it ignores segments that are not loaded in the
virtual address space. It was marking segments that were purely BSS --
having no content in the file, but in zero-initialized memory when
running in the virtual address space -- as not-loadable, unless they
were named "DATA". This works pretty well for typical userland binaries,
but in less Darwin environments, there may be BSS segments with other
names, that ARE loadable.

I looked at the origin of SectionIsLoadable's check for this, and it was
a cleanup by Greg in 2018 where we had three different implementations
of the idea in ObjectFileMachO and one of them skipped zero-file-size
segments (BSS), which made it into the centralized SectionIsLoadable
method.

Also add some logging to the DynamicLoader log channel when loading a
binary - it's the first place I look when debugging segment address
setting bugs, and it wasn't emitting anything.

rdar://129870649



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