Skip to content

Commit 753968c

Browse files
iainsianlancetaylor
authored andcommitted
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. Close #55
1 parent 77bcaa9 commit 753968c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

macho.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,11 @@ struct macho_fat_arch_64
128128

129129
#define MACH_O_CPU_TYPE_X86 7
130130
#define MACH_O_CPU_TYPE_ARM 12
131+
#define MACH_O_CPU_TYPE_PPC 18
131132

132133
#define MACH_O_CPU_TYPE_X86_64 (MACH_O_CPU_TYPE_X86 | MACH_O_CPU_ARCH_ABI64)
133134
#define MACH_O_CPU_TYPE_ARM64 (MACH_O_CPU_TYPE_ARM | MACH_O_CPU_ARCH_ABI64)
135+
#define MACH_O_CPU_TYPE_PPC64 (MACH_O_CPU_TYPE_PPC | MACH_O_CPU_ARCH_ABI64)
134136

135137
/* The header of a load command. */
136138

@@ -776,6 +778,10 @@ macho_add_fat (struct backtrace_state *state, const char *filename,
776778
cputype = MACH_O_CPU_TYPE_ARM64;
777779
#elif defined (__arm__)
778780
cputype = MACH_O_CPU_TYPE_ARM;
781+
#elif defined (__ppc__)
782+
cputype = MACH_O_CPU_TYPE_PPC;
783+
#elif defined (__ppc64__)
784+
cputype = MACH_O_CPU_TYPE_PPC64;
779785
#else
780786
error_callback (data, "unknown Mach-O architecture", 0);
781787
goto fail;

0 commit comments

Comments
 (0)