aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Stange <mstange@themasta.com>2017-03-20 16:03:55 -0400
committerTed Mielczarek <ted@mielczarek.org>2017-05-26 16:03:39 +0000
commit8880afb7624e4f84b92b64c4d7e8455d11fd63ab (patch)
tree74eafc35e984b3eb28b85fbe6a104f3dc929f496
parentDon't attempt to use PTRACE_GETREGS if it isn't defined. (diff)
downloadbreakpad-8880afb7624e4f84b92b64c4d7e8455d11fd63ab.tar.xz
Make the cross-compilation glue for dump_syms Mac handle x86_64h.
x86_64h has a different cpusubtype from x86_64. The h is for Haswell. BUG= Change-Id: Icf884e5699fe120c12d13aa57cd62db5b69a2ce6 Reviewed-on: https://chromium-review.googlesource.com/457171 Reviewed-by: Ted Mielczarek <ted@mielczarek.org>
-rw-r--r--src/common/mac/arch_utilities.cc28
-rw-r--r--src/third_party/mac_headers/mach/machine.h1
2 files changed, 25 insertions, 4 deletions
diff --git a/src/common/mac/arch_utilities.cc b/src/common/mac/arch_utilities.cc
index 4e5f5534..c9225e00 100644
--- a/src/common/mac/arch_utilities.cc
+++ b/src/common/mac/arch_utilities.cc
@@ -111,6 +111,7 @@ namespace {
enum Architecture {
kArch_i386 = 0,
kArch_x86_64,
+ kArch_x86_64h,
kArch_arm,
kArch_arm64,
kArch_ppc,
@@ -136,6 +137,13 @@ const NXArchInfo kKnownArchitectures[] = {
"Intel x86-64"
},
{
+ "x86_64h",
+ CPU_TYPE_X86_64,
+ CPU_SUBTYPE_X86_64_H,
+ NX_LittleEndian,
+ "Intel x86-64h Haswell"
+ },
+ {
"arm",
CPU_TYPE_ARM,
CPU_SUBTYPE_ARM_ALL,
@@ -189,23 +197,35 @@ const NXArchInfo *NXGetArchInfoFromName(const char *name) {
const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
cpu_subtype_t cpusubtype) {
+ const NXArchInfo *candidate = NULL;
for (int arch = 0; arch < kNumArchitectures; ++arch) {
if (kKnownArchitectures[arch].cputype == cputype) {
- return &kKnownArchitectures[arch];
+ if (kKnownArchitectures[arch].cpusubtype == cpusubtype) {
+ return &kKnownArchitectures[arch];
+ }
+ if (!candidate) {
+ candidate = &kKnownArchitectures[arch];
+ }
}
}
- return NULL;
+ return candidate;
}
struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
cpu_subtype_t cpusubtype,
struct fat_arch *fat_archs,
uint32_t nfat_archs) {
+ struct fat_arch *candidate = NULL;
for (uint32_t f = 0; f < nfat_archs; ++f) {
if (fat_archs[f].cputype == cputype) {
- return &fat_archs[f];
+ if (fat_archs[f].cpusubtype == cpusubtype) {
+ return &fat_archs[f];
+ }
+ if (!candidate) {
+ candidate = &fat_archs[f];
+ }
}
}
- return NULL;
+ return candidate;
}
#endif // !__APPLE__
diff --git a/src/third_party/mac_headers/mach/machine.h b/src/third_party/mac_headers/mach/machine.h
index 91d9d709..5bb21e48 100644
--- a/src/third_party/mac_headers/mach/machine.h
+++ b/src/third_party/mac_headers/mach/machine.h
@@ -228,6 +228,7 @@ typedef integer_t cpu_threadtype_t;
#define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3)
#define CPU_SUBTYPE_X86_64_ALL ((cpu_subtype_t)3)
#define CPU_SUBTYPE_X86_ARCH1 ((cpu_subtype_t)4)
+#define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell feature subset */
#define CPU_THREADTYPE_INTEL_HTT ((cpu_threadtype_t) 1)