Change Platform::GetRemoteSharedModule so if it's given a ModuleSpec

which specifies a file path and UUID but not an architecture, open
the file at that path and try every one of the architectures in the
file to see if there is a UUID match.  Currently we'll pick the
first slice of a multi-architecture file and return that as the
match, and when the UUID doesn't match because it's the wrong
architecture, we'll end up ignoring the file.

<rdar://problem/28487804> 

llvm-svn: 283295
This commit is contained in:
Jason Molenda 2016-10-05 02:29:13 +00:00
parent e4f0b75e3d
commit 3fce2fdf4c
1 changed files with 19 additions and 0 deletions

View File

@ -1557,6 +1557,25 @@ Error Platform::GetRemoteSharedModule(const ModuleSpec &module_spec,
}
}
if (module_spec.GetArchitecture().IsValid() == false) {
Error error;
// No valid architecture was specified, ask the platform for
// the architectures that we should be using (in the correct order)
// and see if we can find a match that way
ModuleSpec arch_module_spec(module_spec);
for (uint32_t idx = 0; GetSupportedArchitectureAtIndex(
idx, arch_module_spec.GetArchitecture());
++idx) {
error = ModuleList::GetSharedModule(arch_module_spec, module_sp, nullptr,
nullptr, nullptr);
// Did we find an executable using one of the
if (error.Success() && module_sp)
break;
}
if (module_sp)
got_module_spec = true;
}
if (!got_module_spec) {
// Get module information from a target.
if (!GetModuleSpec(module_spec.GetFileSpec(), module_spec.GetArchitecture(),