Bug 1346604 - Make the cross-compilation glue for dump_syms Mac handle x86_64h. r?ted.mielczarek draft
authorMarkus Stange <mstange@themasta.com>
Sat, 11 Mar 2017 19:36:52 -0500
changeset 497182 8bed821050ab67496143f671d17a5f6b68aab34a
parent 497180 dcce5d7c44f15da9d0ec6f783b0b86514ac8dbdc
child 548815 b8b72e20cbf32523011ca43c6d68a71ed6c6446c
push id48817
push userbmo:mstange@themasta.com
push dateSun, 12 Mar 2017 00:37:26 +0000
reviewersted.mielczarek
bugs1346604
milestone55.0a1
Bug 1346604 - Make the cross-compilation glue for dump_syms Mac handle x86_64h. r?ted.mielczarek MozReview-Commit-ID: 1CzwtiTbRDf
toolkit/crashreporter/google-breakpad/src/common/mac/arch_utilities.cc
toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine.h
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/arch_utilities.cc
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/arch_utilities.cc
@@ -106,16 +106,17 @@ const NXArchInfo* BreakpadGetArchInfoFro
 }  // namespace google_breakpad
 
 #ifndef __APPLE__
 namespace {
 
 enum Architecture {
   kArch_i386 = 0,
   kArch_x86_64,
+  kArch_x86_64h,
   kArch_arm,
   kArch_arm64,
   kArch_ppc,
   // This must be last.
   kNumArchitectures
 };
 
 // enum Architecture above and kKnownArchitectures below
@@ -131,16 +132,23 @@ const NXArchInfo kKnownArchitectures[] =
   {
     "x86_64",
     CPU_TYPE_X86_64,
     CPU_SUBTYPE_X86_64_ALL,
     NX_LittleEndian,
     "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,
     NX_LittleEndian,
     "ARM"
   },
   {
     "arm64",
@@ -184,28 +192,40 @@ const NXArchInfo *NXGetArchInfoFromName(
       return &kKnownArchitectures[arch];
     }
   }
   return NULL;
 }
 
 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__
--- a/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine.h
+++ b/toolkit/crashreporter/google-breakpad/src/third_party/mac_headers/mach/machine.h
@@ -223,16 +223,17 @@ typedef integer_t	cpu_threadtype_t;
 
 /*
  *	X86 subtypes.
  */
 
 #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)
 
 /*
  *	Mips subtypes.
  */