Skip to content

Commit f412dab

Browse files
committed
[lldb] MachO delay-init binaries don't load as dependent
(cherry picked from commit 954d00e)
1 parent 8ccd572 commit f412dab

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
@@ -5172,8 +5172,17 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) {
51725172
case LC_LOADFVMLIB:
51735173
case LC_LOAD_UPWARD_DYLIB: {
51745174
uint32_t name_offset = cmd_offset + m_data.GetU32(&offset);
5175+
bool is_delayed_init = false;
5176+
uint32_t use_command_marker = m_data.GetU32(&offset);
5177+
if (use_command_marker == 0x1a741800 /* DYLIB_USE_MARKER */) {
5178+
offset += 4; /* uint32_t current_version */
5179+
offset += 4; /* uint32_t compat_version */
5180+
uint32_t flags = m_data.GetU32(&offset);
5181+
if (flags & 0x08 /* DYLIB_USE_DELAYED_INIT */)
5182+
is_delayed_init = true;
5183+
}
51755184
const char *path = m_data.PeekCStr(name_offset);
5176-
if (path) {
5185+
if (path && !is_delayed_init) {
51775186
if (load_cmd.cmd == LC_RPATH)
51785187
rpath_paths.push_back(path);
51795188
else {

0 commit comments

Comments
 (0)