Add mac dump_syms support for arm64e

Change-Id: I6a25b47d4fc5e42ff9fa30107b563dcf1d51c0d1
Reviewed-on: https://chromium-review.googlesource.com/c/1351352
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Joshua Peraza 2018-11-26 09:53:17 -08:00
parent 5cbd3c69e0
commit e42f2456b7
3 changed files with 45 additions and 4 deletions

View file

@ -46,15 +46,31 @@
#define CPU_SUBTYPE_ARM64_ALL (static_cast<cpu_subtype_t>(0))
#endif // CPU_SUBTYPE_ARM64_ALL
#ifndef CPU_SUBTYPE_ARM64_E
#define CPU_SUBTYPE_ARM64_E (static_cast<cpu_subtype_t>(2))
#endif // CPU_SUBTYPE_ARM64_E
namespace {
const NXArchInfo* ArchInfo_arm64() {
const NXArchInfo* ArchInfo_arm64(cpu_subtype_t cpu_subtype) {
const char* name = NULL;
switch (cpu_subtype) {
case CPU_SUBTYPE_ARM64_ALL:
name = "arm64";
break;
case CPU_SUBTYPE_ARM64_E:
name = "arm64e";
break;
default:
return NULL;
}
NXArchInfo* arm64 = new NXArchInfo;
*arm64 = *NXGetArchInfoFromCpuType(CPU_TYPE_ARM,
CPU_SUBTYPE_ARM_V7);
arm64->name = "arm64";
arm64->name = name;
arm64->cputype = CPU_TYPE_ARM64;
arm64->cpusubtype = CPU_SUBTYPE_ARM64_ALL;
arm64->cpusubtype = cpu_subtype;
arm64->description = "arm 64";
return arm64;
}
@ -79,6 +95,10 @@ const NXArchInfo* BreakpadGetArchInfoFromName(const char* arch_name) {
return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM64,
CPU_SUBTYPE_ARM64_ALL);
if (!strcmp("arm64e", arch_name))
return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM64,
CPU_SUBTYPE_ARM64_E);
// TODO: Remove this when the OS knows about armv7s.
if (!strcmp("armv7s", arch_name))
return BreakpadGetArchInfoFromCpuType(CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7S);
@ -90,10 +110,15 @@ const NXArchInfo* BreakpadGetArchInfoFromCpuType(cpu_type_t cpu_type,
cpu_subtype_t cpu_subtype) {
// TODO: Remove this when the OS knows about arm64.
if (cpu_type == CPU_TYPE_ARM64 && cpu_subtype == CPU_SUBTYPE_ARM64_ALL) {
static const NXArchInfo* arm64 = ArchInfo_arm64();
static const NXArchInfo* arm64 = ArchInfo_arm64(cpu_subtype);
return arm64;
}
if (cpu_type == CPU_TYPE_ARM64 && cpu_subtype == CPU_SUBTYPE_ARM64_E) {
static const NXArchInfo* arm64e = ArchInfo_arm64(cpu_subtype);
return arm64e;
}
// TODO: Remove this when the OS knows about armv7s.
if (cpu_type == CPU_TYPE_ARM && cpu_subtype == CPU_SUBTYPE_ARM_V7S) {
static const NXArchInfo* armv7s = ArchInfo_armv7s();
@ -114,6 +139,7 @@ enum Architecture {
kArch_x86_64h,
kArch_arm,
kArch_arm64,
kArch_arm64e,
kArch_ppc,
// This must be last.
kNumArchitectures
@ -157,6 +183,13 @@ const NXArchInfo kKnownArchitectures[] = {
NX_LittleEndian,
"ARM64"
},
{
"arm64e",
CPU_TYPE_ARM64,
CPU_SUBTYPE_ARM64_E,
NX_LittleEndian,
"ARM64e"
},
{
"ppc",
CPU_TYPE_POWERPC,

View file

@ -43,10 +43,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define CPU_SUBTYPE_ARM64_ALL 0
#endif
#ifndef CPU_SUBTYPE_ARM64_E
#define CPU_SUBTYPE_ARM64_E 2
#endif
const cpu_type_t kCPU_TYPE_ARM = CPU_TYPE_ARM;
const cpu_type_t kCPU_TYPE_ARM64 = CPU_TYPE_ARM64;
const cpu_subtype_t kCPU_SUBTYPE_ARM64_ALL = CPU_SUBTYPE_ARM64_ALL;
const cpu_subtype_t kCPU_SUBTYPE_ARM64_E = CPU_SUBTYPE_ARM64_E;
const cpu_subtype_t kCPU_SUBTYPE_ARM_V7S = CPU_SUBTYPE_ARM_V7S;
const char* GetNXArchInfoName(cpu_type_t cpu_type, cpu_subtype_t cpu_subtype) {

View file

@ -47,6 +47,9 @@ func getArchStringFromHeader(header macho.FileHeader) string {
if header.Cpu == C.kCPU_TYPE_ARM64 && header.SubCpu == C.kCPU_SUBTYPE_ARM64_ALL {
return "arm64"
}
if header.Cpu == C.kCPU_TYPE_ARM64 && header.SubCpu == C.kCPU_SUBTYPE_ARM64_E {
return "arm64e"
}
if header.Cpu == C.kCPU_TYPE_ARM && header.SubCpu == C.kCPU_SUBTYPE_ARM_V7S {
return "armv7s"
}