From 4b6a4e91d05f2d295b60f763c21f6608d1a414be Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 21 Sep 2017 20:23:16 -0700 Subject: breakpad: Fix build with musl/mips Signed-off-by: Khem Raj Signed-off-by: Martin Jansa --- .../breakpad/breakpad/mcontext.patch | 77 ++++++++++++++++++++++ .../breakpad/breakpad/mips_asm_sgidefs.patch | 9 ++- meta-oe/recipes-devtools/breakpad/breakpad_git.bb | 3 + 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/mcontext.patch diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/mcontext.patch b/meta-oe/recipes-devtools/breakpad/breakpad/mcontext.patch new file mode 100644 index 0000000000..42e073b94d --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/mcontext.patch @@ -0,0 +1,77 @@ +map the mcontext_t structure for musl + +Upstream-Status: Inappropriate[need to consider Android] + +Signed-off-by: Khem Raj +Index: git/src/client/linux/dump_writer_common/thread_info.cc +=================================================================== +--- git.orig/src/client/linux/dump_writer_common/thread_info.cc ++++ git/src/client/linux/dump_writer_common/thread_info.cc +@@ -229,7 +229,6 @@ void ThreadInfo::FillCPUContext(RawConte + } + + #elif defined(__mips__) +- + uintptr_t ThreadInfo::GetInstructionPointer() const { + return mcontext.pc; + } +@@ -263,8 +262,11 @@ void ThreadInfo::FillCPUContext(RawConte + out->cause = 0; // Not stored in mcontext + + for (int i = 0; i < MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT; ++i) ++#ifdef __GLIBC__ + out->float_save.regs[i] = mcontext.fpregs.fp_r.fp_fregs[i]._fp_fregs; +- ++#else ++ out->float_save.regs[i] = mcontext.fpregs[i]; ++#endif + out->float_save.fpcsr = mcontext.fpc_csr; + #if _MIPS_SIM == _ABIO32 + out->float_save.fir = mcontext.fpc_eir; +Index: git/src/client/linux/dump_writer_common/ucontext_reader.cc +=================================================================== +--- git.orig/src/client/linux/dump_writer_common/ucontext_reader.cc ++++ git/src/client/linux/dump_writer_common/ucontext_reader.cc +@@ -247,8 +247,11 @@ void UContextReader::FillCPUContext(RawC + out->cause = 0; // Not reported in signal context. + + for (int i = 0; i < MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT; ++i) ++#ifdef __GLIBC__ + out->float_save.regs[i] = uc->uc_mcontext.fpregs.fp_r.fp_dregs[i]; +- ++#else ++ out->float_save.regs[i] = uc->uc_mcontext.fpregs[i]; ++#endif + out->float_save.fpcsr = uc->uc_mcontext.fpc_csr; + #if _MIPS_SIM == _ABIO32 + out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused. +Index: git/src/client/linux/minidump_writer/linux_core_dumper.cc +=================================================================== +--- git.orig/src/client/linux/minidump_writer/linux_core_dumper.cc ++++ git/src/client/linux/minidump_writer/linux_core_dumper.cc +@@ -196,7 +196,7 @@ bool LinuxCoreDumper::EnumerateThreads() + info.tgid = status->pr_pgrp; + info.ppid = status->pr_ppid; + #if defined(__mips__) +-#if defined(__ANDROID__) ++#if defined(__ANDROID__) || !defined(__GLIBC__) + for (int i = EF_R0; i <= EF_R31; i++) + info.mcontext.gregs[i - EF_R0] = status->pr_reg[i]; + #else // __ANDROID__ +Index: git/src/tools/linux/md2core/minidump-2-core.cc +=================================================================== +--- git.orig/src/tools/linux/md2core/minidump-2-core.cc ++++ git/src/tools/linux/md2core/minidump-2-core.cc +@@ -516,8 +516,12 @@ ParseThreadRegisters(CrashedProcess::Thr + thread->mcontext.lo3 = rawregs->lo[2]; + + for (int i = 0; i < MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT; ++i) { ++#ifdef __GLIBC__ + thread->mcontext.fpregs.fp_r.fp_fregs[i]._fp_fregs = + rawregs->float_save.regs[i]; ++#else ++ thread->mcontext.fpregs[i] = rawregs->float_save.regs[i]; ++#endif + } + + thread->mcontext.fpc_csr = rawregs->float_save.fpcsr; diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/mips_asm_sgidefs.patch b/meta-oe/recipes-devtools/breakpad/breakpad/mips_asm_sgidefs.patch index 678f63d74a..19bb560445 100644 --- a/meta-oe/recipes-devtools/breakpad/breakpad/mips_asm_sgidefs.patch +++ b/meta-oe/recipes-devtools/breakpad/breakpad/mips_asm_sgidefs.patch @@ -2,7 +2,7 @@ Index: lss/linux_syscall_support.h =================================================================== --- lss.orig/linux_syscall_support.h +++ lss/linux_syscall_support.h -@@ -118,15 +118,7 @@ extern "C" { +@@ -118,21 +118,13 @@ extern "C" { #include #ifdef __mips__ @@ -18,3 +18,10 @@ Index: lss/linux_syscall_support.h #endif #endif + /* The Android NDK's #defines these macros as aliases + * to their non-64 counterparts. To avoid naming conflict, remove them. */ +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) || (defined(__linux__) && !defined(__glibc__)) + /* These are restored by the corresponding #pragma pop_macro near + * the end of this file. */ + # pragma push_macro("stat64") diff --git a/meta-oe/recipes-devtools/breakpad/breakpad_git.bb b/meta-oe/recipes-devtools/breakpad/breakpad_git.bb index 1ddd6b5655..a17759eb42 100644 --- a/meta-oe/recipes-devtools/breakpad/breakpad_git.bb +++ b/meta-oe/recipes-devtools/breakpad/breakpad_git.bb @@ -40,11 +40,14 @@ SRC_URI = "git://github.com/google/breakpad;name=breakpad \ file://0004-elf_reader.cc-include-sys-reg.h-to-get-__WORDSIZE-on.patch \ file://0005-md2core-Replace-basename.patch \ file://0002-Use-_fpstate-instead-of-_libc_fpstate-on-linux.patch \ + file://mcontext.patch \ file://0001-lss-Match-syscalls-to-match-musl.patch;patchdir=src/third_party/lss \ file://mips_asm_sgidefs.patch;patchdir=src/third_party/lss \ " S = "${WORKDIR}/git" +CXXFLAGS += "-D_GNU_SOURCE" + COMPATIBLE_MACHINE_powerpc = "(!.*ppc).*" do_install_append() { -- cgit 1.2.3-korg