Fix build on powerpc64 ELFv2

- Teach glog how to use program counter

PR:		242343
Submitted by:	pkubaj
This commit is contained in:
Sunpoet Po-Chuan Hsieh 2019-12-10 17:16:31 +00:00
parent d4aa09f716
commit ae42cf0f40
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=519762
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,10 @@
--- m4/pc_from_ucontext.m4.orig 2019-09-01 20:36:55 UTC
+++ m4/pc_from_ucontext.m4
@@ -21,6 +21,7 @@ AC_DEFUN([AC_PC_FROM_UCONTEXT],
pc_fields="$pc_fields uc_mcontext.gregs[[R15]]" # Linux (arm old [untested])
pc_fields="$pc_fields uc_mcontext.arm_pc" # Linux (arm new [untested])
pc_fields="$pc_fields uc_mcontext.mc_eip" # FreeBSD (i386)
+ pc_fields="$pc_fields uc_mcontext.mc_srr0" # FreeBSD (powerpc, powerpc64)
pc_fields="$pc_fields uc_mcontext.mc_rip" # FreeBSD (x86_64 [untested])
pc_fields="$pc_fields uc_mcontext.__gregs[[_REG_EIP]]" # NetBSD (i386)
pc_fields="$pc_fields uc_mcontext.__gregs[[_REG_RIP]]" # NetBSD (x86_64)

View file

@ -0,0 +1,11 @@
--- src/stacktrace_powerpc-inl.h.orig 2019-12-01 18:35:43 UTC
+++ src/stacktrace_powerpc-inl.h
@@ -107,7 +107,7 @@ int GetStackTrace(void** result, int max_depth, int sk
// Link Register is. For DARWIN and AIX (used by apple and
// linux ppc64), it's in sp[2]. For SYSV (used by linux ppc),
// it's in sp[1].
-#if defined(_CALL_AIX) || defined(_CALL_DARWIN)
+#if defined(_CALL_AIX) || defined(_CALL_DARWIN) || defined(_CALL_ELF)
result[n++] = *(sp+2);
#elif defined(_CALL_SYSV)
result[n++] = *(sp+1);