summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-10-28 23:26:59 +0000
committerGreg Clayton <gclayton@apple.com>2015-10-28 23:26:59 +0000
commita37068885a516c7e3a5df8b0b0f8c5b95c9bfc9d (patch)
tree7ef0602f9c61740bd332e71ffe658d53b7bc4c7c /lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
parent21e36c4f89b0ca6e6516a48e15b3a5aed497f001 (diff)
downloadbcm5719-llvm-a37068885a516c7e3a5df8b0b0f8c5b95c9bfc9d.tar.gz
bcm5719-llvm-a37068885a516c7e3a5df8b0b0f8c5b95c9bfc9d.zip
Make sure we don't over specify an architecture when we connect to KDP and use the CPU type and subtype to fill out an architecture. We do this by letting the vendor be an unspecified unknown, or any. We also grab the target architecture, get the KDP host arch, and then merge the two before putting it back into the target.
Also change MH_PRELOAD to be use "unspecified unknown" (any) for the OS and vendor since these mach files can really be anything. llvm-svn: 251579
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 625418c508a..18a6a987388 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -4768,16 +4768,22 @@ ObjectFileMachO::GetArchitecture (const llvm::MachO::mach_header &header,
if (arch.IsValid())
{
llvm::Triple &triple = arch.GetTriple();
+
+ // Set OS to an unspecified unknown or a "*" so it can match any OS
+ triple.setOS(llvm::Triple::UnknownOS);
+ triple.setOSName(llvm::StringRef());
+
if (header.filetype == MH_PRELOAD)
{
- // Set OS to "unknown" - this is a standalone binary with no dyld et al
- triple.setOS(llvm::Triple::UnknownOS);
+ // Set vendor to an unspecified unknown or a "*" so it can match any vendor
+ triple.setVendor(llvm::Triple::UnknownVendor);
+ triple.setVendorName(llvm::StringRef());
return true;
}
else
{
struct load_command load_cmd;
-
+
lldb::offset_t offset = lc_offset;
for (uint32_t i=0; i<header.ncmds; ++i)
{
@@ -4802,14 +4808,13 @@ ObjectFileMachO::GetArchitecture (const llvm::MachO::mach_header &header,
offset = cmd_offset + load_cmd.cmdsize;
}
- // Only set the OS to iOS for ARM, we don't want to set it for x86 and x86_64.
- // We do this because we now have MacOSX or iOS as the OS value for x86 and
- // x86_64 for normal desktop (MacOSX) and simulator (iOS) binaries. And if
- // we compare a "x86_64-apple-ios" to a "x86_64-apple-" triple, it will say
- // it is compatible (because the OS is unspecified in the second one and will
- // match anything in the first
- if (header.cputype == CPU_TYPE_ARM || header.cputype == CPU_TYPE_ARM64)
- triple.setOS (llvm::Triple::IOS);
+ if (header.filetype != MH_KEXT_BUNDLE)
+ {
+ // We didn't find a LC_VERSION_MIN load command and this isn't a KEXT
+ // so lets not say our Vendor is Apple, leave it as an unspecified unknown
+ triple.setVendor(llvm::Triple::UnknownVendor);
+ triple.setVendorName(llvm::StringRef());
+ }
}
}
return arch.IsValid();
OpenPOWER on IntegriCloud