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>
This commit is contained in:
Markus Stange 2017-03-20 16:03:55 -04:00 committed by Ted Mielczarek
parent dc3ba60f0f
commit 8880afb762
2 changed files with 25 additions and 4 deletions

View File

@ -111,6 +111,7 @@ namespace {
enum Architecture { enum Architecture {
kArch_i386 = 0, kArch_i386 = 0,
kArch_x86_64, kArch_x86_64,
kArch_x86_64h,
kArch_arm, kArch_arm,
kArch_arm64, kArch_arm64,
kArch_ppc, kArch_ppc,
@ -135,6 +136,13 @@ const NXArchInfo kKnownArchitectures[] = {
NX_LittleEndian, NX_LittleEndian,
"Intel x86-64" "Intel x86-64"
}, },
{
"x86_64h",
CPU_TYPE_X86_64,
CPU_SUBTYPE_X86_64_H,
NX_LittleEndian,
"Intel x86-64h Haswell"
},
{ {
"arm", "arm",
CPU_TYPE_ARM, CPU_TYPE_ARM,
@ -189,23 +197,35 @@ const NXArchInfo *NXGetArchInfoFromName(const char *name) {
const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype, const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
cpu_subtype_t cpusubtype) { cpu_subtype_t cpusubtype) {
const NXArchInfo *candidate = NULL;
for (int arch = 0; arch < kNumArchitectures; ++arch) { for (int arch = 0; arch < kNumArchitectures; ++arch) {
if (kKnownArchitectures[arch].cputype == cputype) { 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, struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
cpu_subtype_t cpusubtype, cpu_subtype_t cpusubtype,
struct fat_arch *fat_archs, struct fat_arch *fat_archs,
uint32_t nfat_archs) { uint32_t nfat_archs) {
struct fat_arch *candidate = NULL;
for (uint32_t f = 0; f < nfat_archs; ++f) { for (uint32_t f = 0; f < nfat_archs; ++f) {
if (fat_archs[f].cputype == cputype) { 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__ #endif // !__APPLE__

View File

@ -228,6 +228,7 @@ typedef integer_t cpu_threadtype_t;
#define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3) #define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3)
#define CPU_SUBTYPE_X86_64_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_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) #define CPU_THREADTYPE_INTEL_HTT ((cpu_threadtype_t) 1)