Skip to content

Commit 954d00e

Browse files
committed
[lldb] MachO delay-init binaries don't load as dependent
1 parent 4113e15 commit 954d00e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5140,8 +5140,17 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) {
51405140
case LC_LOADFVMLIB:
51415141
case LC_LOAD_UPWARD_DYLIB: {
51425142
uint32_t name_offset = cmd_offset + m_data.GetU32(&offset);
5143+
bool is_delayed_init = false;
5144+
uint32_t use_command_marker = m_data.GetU32(&offset);
5145+
if (use_command_marker == 0x1a741800 /* DYLIB_USE_MARKER */) {
5146+
offset += 4; /* uint32_t current_version */
5147+
offset += 4; /* uint32_t compat_version */
5148+
uint32_t flags = m_data.GetU32(&offset);
5149+
if (flags & 0x08 /* DYLIB_USE_DELAYED_INIT */)
5150+
is_delayed_init = true;
5151+
}
51435152
const char *path = m_data.PeekCStr(name_offset);
5144-
if (path) {
5153+
if (path && !is_delayed_init) {
51455154
if (load_cmd.cmd == LC_RPATH)
51465155
rpath_paths.push_back(path);
51475156
else {

0 commit comments

Comments
 (0)