summaryrefslogtreecommitdiff
path: root/libbacktrace/macho.c
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2020-09-16 08:03:05 +0100
committerIain Sandoe <iain@sandoe.co.uk>2020-09-16 19:37:28 +0100
commitd1339b519ae8cc4ae550baa127a21d8350462837 (patch)
tree300f941d65799e55e6b9f2c5ff67bd882418e256 /libbacktrace/macho.c
parentaab6194d0898f5c592708fe2d44a14046b4d9097 (diff)
libbacktrace, Mach-O : Support PowerPC archs.
This adds the PPC architecture variants for Mach-O libbacktrace. With this (as for X86 and Arm) when dsymutil is run on the binary we get a basic usable backtrace. Testsuite results on powerpc-apple-darwin9 are the same as for X86: * btest fails (TBC why) * dwarf5 tests fail because dsymutil does not handle that so far. libbacktrace/ChangeLog: * macho.c (MACH_O_CPU_TYPE_PPC): New. (MACH_O_CPU_TYPE_PPC64): New. Add compile-tests for powerpc to the Mach-O variants.
Diffstat (limited to 'libbacktrace/macho.c')
-rw-r--r--libbacktrace/macho.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libbacktrace/macho.c b/libbacktrace/macho.c
index 241d54b5e5e..1f8bc50238f 100644
--- a/libbacktrace/macho.c
+++ b/libbacktrace/macho.c
@@ -128,9 +128,11 @@ struct macho_fat_arch_64
#define MACH_O_CPU_TYPE_X86 7
#define MACH_O_CPU_TYPE_ARM 12
+#define MACH_O_CPU_TYPE_PPC 18
#define MACH_O_CPU_TYPE_X86_64 (MACH_O_CPU_TYPE_X86 | MACH_O_CPU_ARCH_ABI64)
#define MACH_O_CPU_TYPE_ARM64 (MACH_O_CPU_TYPE_ARM | MACH_O_CPU_ARCH_ABI64)
+#define MACH_O_CPU_TYPE_PPC64 (MACH_O_CPU_TYPE_PPC | MACH_O_CPU_ARCH_ABI64)
/* The header of a load command. */
@@ -776,6 +778,10 @@ macho_add_fat (struct backtrace_state *state, const char *filename,
cputype = MACH_O_CPU_TYPE_ARM64;
#elif defined (__arm__)
cputype = MACH_O_CPU_TYPE_ARM;
+#elif defined (__ppc__)
+ cputype = MACH_O_CPU_TYPE_PPC;
+#elif defined (__ppc64__)
+ cputype = MACH_O_CPU_TYPE_PPC64;
#else
error_callback (data, "unknown Mach-O architecture", 0);
goto fail;