mirror of
https://github.com/intel/llvm.git
synced 2026-01-15 12:25:46 +08:00
Add method Module::IsLoadedInTarget, and then in the MacOS X dynamic loader, after we
have initialized our shared library state, discard all the modules that didn't make it into the running process. llvm-svn: 136755
This commit is contained in:
@@ -690,6 +690,29 @@ Module::IsExecutable ()
|
||||
return GetObjectFile()->IsExecutable();
|
||||
}
|
||||
|
||||
bool
|
||||
Module::IsLoadedInTarget (Target *target)
|
||||
{
|
||||
ObjectFile *obj_file = GetObjectFile();
|
||||
if (obj_file)
|
||||
{
|
||||
SectionList *sections = obj_file->GetSectionList();
|
||||
if (sections != NULL)
|
||||
{
|
||||
size_t num_sections = sections->GetSize();
|
||||
bool loaded = false;
|
||||
for (size_t sect_idx = 0; sect_idx < num_sections; sect_idx++)
|
||||
{
|
||||
SectionSP section_sp = sections->GetSectionAtIndex(sect_idx);
|
||||
if (section_sp->GetLoadBaseAddress(target) != LLDB_INVALID_ADDRESS)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool
|
||||
Module::SetArchitecture (const ArchSpec &new_arch)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user