forked from OSchip/llvm-project
Change ModuleList::GetSharedModule so that it will reject "stub
libraries" altogether. On Mac/iOS, these are libraries which have a UUID and nlist records but no text or data. If one of these gets into the global module list, every time we try to search for a given filename/arch/UUID, we'll get this stub library back. We need to prevent them from getting added to the module list altogether. I thought about doing this down in ObjectFileMachO -- just rejecting the file as a valid binary file altogether -- but Greg didn't want to take that hard line approach at this point, he wanted to keep the ability for lldb to read one of these if someone wanted to in the future. <rdar://problem/23035075> llvm-svn: 250979
This commit is contained in:
parent
75f96bcfc4
commit
9c077cf33d
|
@ -989,18 +989,31 @@ ModuleList::GetSharedModule
|
|||
// If we get in here we got the correct arch, now we just need
|
||||
// to verify the UUID if one was given
|
||||
if (uuid_ptr && *uuid_ptr != module_sp->GetUUID())
|
||||
{
|
||||
module_sp.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (did_create_ptr)
|
||||
*did_create_ptr = true;
|
||||
if (module_sp->GetObjectFile() && module_sp->GetObjectFile()->GetType() == ObjectFile::eTypeStubLibrary)
|
||||
{
|
||||
module_sp.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (did_create_ptr)
|
||||
{
|
||||
*did_create_ptr = true;
|
||||
}
|
||||
|
||||
shared_module_list.ReplaceEquivalent(module_sp);
|
||||
return error;
|
||||
shared_module_list.ReplaceEquivalent(module_sp);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
module_sp.reset();
|
||||
}
|
||||
|
||||
if (module_search_paths_ptr)
|
||||
{
|
||||
|
@ -1024,18 +1037,29 @@ ModuleList::GetSharedModule
|
|||
// If we get in here we got the correct arch, now we just need
|
||||
// to verify the UUID if one was given
|
||||
if (uuid_ptr && *uuid_ptr != module_sp->GetUUID())
|
||||
{
|
||||
module_sp.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (did_create_ptr)
|
||||
*did_create_ptr = true;
|
||||
|
||||
shared_module_list.ReplaceEquivalent(module_sp);
|
||||
return Error();
|
||||
if (module_sp->GetObjectFile()->GetType() == ObjectFile::eTypeStubLibrary)
|
||||
{
|
||||
module_sp.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (did_create_ptr)
|
||||
*did_create_ptr = true;
|
||||
|
||||
shared_module_list.ReplaceEquivalent(module_sp);
|
||||
return Error();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
module_sp.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1119,10 +1143,17 @@ ModuleList::GetSharedModule
|
|||
// By getting the object file we can guarantee that the architecture matches
|
||||
if (module_sp && module_sp->GetObjectFile())
|
||||
{
|
||||
if (did_create_ptr)
|
||||
*did_create_ptr = true;
|
||||
if (module_sp->GetObjectFile()->GetType() == ObjectFile::eTypeStubLibrary)
|
||||
{
|
||||
module_sp.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (did_create_ptr)
|
||||
*did_create_ptr = true;
|
||||
|
||||
shared_module_list.ReplaceEquivalent(module_sp);
|
||||
shared_module_list.ReplaceEquivalent(module_sp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue