Skip to contentSkip to conversation

breakpad: Upgrade to latest master

PATCH New Khem Raj 1 participant 1 message Sep 18, 2017

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 breakpad: Upgrade to latest master

Fix build with musl while here

---
Changes in V2: Fix build with glibc

 .../0001-Turn-off-sign-compare-for-musl-libc.patch |  41 +++++
 ...-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch |  28 +++
 .../0001-lss-Match-syscalls-to-match-musl.patch    |  45 +++++
 .../breakpad/0002-Avoid-using-basename.patch       |  29 +++
 ...fpstate-instead-of-_libc_fpstate-on-linux.patch |  60 +++++++
 ...nal.h-is-a-nonportable-alias-for-signal.h.patch |  26 +++
 .../breakpad/0003-Dont-include-stab.h.patch        |  88 +++++++++
 ...nflict-between-musl-libc-dirent.h-and-lss.patch |  35 ++++
 ...cc-include-sys-reg.h-to-get-__WORDSIZE-on.patch |  43 +++++
 ...-Import-necessary-definitions-from-stab.h.patch | 199 +++++++++++++++++++++
 .../breakpad/0005-md2core-Replace-basename.patch   |  38 ++++
 meta-oe/recipes-devtools/breakpad/breakpad_git.bb  |  18 +-
 12 files changed, 645 insertions(+), 5 deletions(-)
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0001-Turn-off-sign-compare-for-musl-libc.patch
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0001-include-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0001-lss-Match-syscalls-to-match-musl.patch
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0002-Avoid-using-basename.patch
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0002-Use-_fpstate-instead-of-_libc_fpstate-on-linux.patch
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0002-sys-signal.h-is-a-nonportable-alias-for-signal.h.patch
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0003-Dont-include-stab.h.patch
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0003-Fix-conflict-between-musl-libc-dirent.h-and-lss.patch
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0004-elf_reader.cc-include-sys-reg.h-to-get-__WORDSIZE-on.patch
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0005-Import-necessary-definitions-from-stab.h.patch
 create mode 100644 meta-oe/recipes-devtools/breakpad/breakpad/0005-md2core-Replace-basename.patch
meta-oe/recipes-devtools/breakpad/breakpad/0001-Turn-off-sign-compare-for-musl-libc.patch new file +41 -0
new file mode 100644
index 000000000..33bae1a37
@@ -0,0 +1,41 @@
+From ab8dcad25d0ac1f3a88814e78794e5d450de15ac Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 14 Sep 2017 23:12:51 -0700
+Subject: [PATCH 1/5] Turn off sign-compare for musl-libc
+
+Fix
+
+../../../../../../../workspace/sources/breakpad/src/client/linux/crash_generation/crash_generation_server.cc:234:14: error:                 comparison of integers of different signs: 'unsigned long' and 'int' [-Werror,-Wsign-compare]                                          hdr = CMSG_NXTHDR(&msg, hdr)) {                                                                                                             ^~~~~~~~~~~~~~~~~~~~~~
+/mnt/a/oe/build/tmp/work/cortexa7hf-neon-vfpv4-bec-linux-musleabi/breakpad/1_1.0+git999-r0/recipe-sysroot/usr/include/sys/socket.h:288:44: note:                                                                                                                                  expanded from macro 'CMSG_NXTHDR'                                                                                                       __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                       1 error generated.
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/client/linux/crash_generation/crash_generation_server.cc | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/client/linux/crash_generation/crash_generation_server.cc b/src/client/linux/crash_generation/crash_generation_server.cc
+index 2596afde..2faeb9e5 100644
+--- a/src/client/linux/crash_generation/crash_generation_server.cc
++++ b/src/client/linux/crash_generation/crash_generation_server.cc
+@@ -230,8 +230,18 @@ CrashGenerationServer::ClientEvent(short revents)
+   // Walk the control payload and extract the file descriptor and validated pid.
+   pid_t crashing_pid = -1;
+   int signal_fd = -1;
++#ifndef __GLIBC__
++  // In musl-libc, CMSG_NXTHDR typecasts char* to cmsghdr* which causes
++  // clang to throw sign-compare warning. This is to suppress the warning
++  // inline.
++  #pragma clang diagnostic push
++  #pragma clang diagnostic ignored "-Wsign-compare"
++#endif
+   for (struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); hdr;
+        hdr = CMSG_NXTHDR(&msg, hdr)) {
++#ifndef __GLIBC__
++  #pragma clang diagnostic pop
++#endif
+     if (hdr->cmsg_level != SOL_SOCKET)
+       continue;
+     if (hdr->cmsg_type == SCM_RIGHTS) {
+-- 
+2.14.1
+
meta-oe/recipes-devtools/breakpad/breakpad/0001-include-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch new file +28 -0
new file mode 100644
index 000000000..4583d601a
@@ -0,0 +1,28 @@
+From 68580cb62f77117be3164c52abae68f75e8e59a1 Mon Sep 17 00:00:00 2001
+From: Felix Janda <[email protected]>
+Date: Sun, 1 Feb 2015 14:26:52 +0100
+Subject: [PATCH 1/3] include <sys/reg.h> to get __WORDSIZE on musl libc
+
+---
+ src/common/linux/elf_core_dump.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: git/src/common/linux/elf_core_dump.h
+===================================================================
+--- git.orig/src/common/linux/elf_core_dump.h
++++ git/src/common/linux/elf_core_dump.h
+@@ -33,10 +33,13 @@
+ #ifndef COMMON_LINUX_ELF_CORE_DUMP_H_
+ #define COMMON_LINUX_ELF_CORE_DUMP_H_
+ 
++#include <config.h>
+ #include <elf.h>
+ #include <link.h>
+ #include <stddef.h>
+-
++#ifdef HAVE_SYS_REG_H
++#include <sys/reg.h>
++#endif
+ #include "common/memory_range.h"
+ 
+ namespace google_breakpad {
meta-oe/recipes-devtools/breakpad/breakpad/0001-lss-Match-syscalls-to-match-musl.patch new file +45 -0

45 lines not on this page · raw message

meta-oe/recipes-devtools/breakpad/breakpad/0002-Avoid-using-basename.patch new file +29 -0
new file mode 100644
index 000000000..bc6282981
@@ -0,0 +1,29 @@
+From 806964f852773e427fea82a7716d44ce3be4498c Mon Sep 17 00:00:00 2001
+From: Felix Janda <[email protected]>
+Date: Sun, 1 Feb 2015 14:27:32 +0100
+Subject: [PATCH 2/3] Avoid using basename
+
+---
+ src/common/linux/dump_symbols.cc | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/common/linux/dump_symbols.cc b/src/common/linux/dump_symbols.cc
+index d029ca14..6ac4a17b 100644
+--- a/src/common/linux/dump_symbols.cc
++++ b/src/common/linux/dump_symbols.cc
+@@ -881,9 +881,9 @@ const char* ElfArchitecture(const typename ElfClass::Ehdr* elf_header) {
+ // last slash, or the whole filename if there are no slashes.
+ string BaseFileName(const string &filename) {
+   // Lots of copies!  basename's behavior is less than ideal.
+-  char* c_filename = strdup(filename.c_str());
+-  string base = basename(c_filename);
+-  free(c_filename);
++  const char *c_filename = filename.c_str();
++  const char *p = strrchr(c_filename, '/');
++  string base = p ? p+1 : c_filename;
+   return base;
+ }
+ 
+-- 
+2.14.1
+
meta-oe/recipes-devtools/breakpad/breakpad/0002-Use-_fpstate-instead-of-_libc_fpstate-on-linux.patch new file +60 -0

60 lines not on this page · raw message

meta-oe/recipes-devtools/breakpad/breakpad/0002-sys-signal.h-is-a-nonportable-alias-for-signal.h.patch new file +26 -0
new file mode 100644
index 000000000..cfd9a9b34
@@ -0,0 +1,26 @@
+From 15582e19c2545d5ffe8ff07f957d0ed602aeca74 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 14 Sep 2017 23:15:09 -0700
+Subject: [PATCH 2/5] <sys/signal.h> is a nonportable alias for <signal.h>
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/client/linux/handler/exception_handler.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc
+index 05936d28..cca023fd 100644
+--- a/src/client/linux/handler/exception_handler.cc
++++ b/src/client/linux/handler/exception_handler.cc
+@@ -78,7 +78,7 @@
+ #include <sys/wait.h>
+ #include <unistd.h>
+ 
+-#include <sys/signal.h>
++#include <signal.h>
+ #include <sys/ucontext.h>
+ #include <sys/user.h>
+ #include <ucontext.h>
+-- 
+2.14.1
+
meta-oe/recipes-devtools/breakpad/breakpad/0003-Dont-include-stab.h.patch new file +88 -0

88 lines not on this page · raw message

meta-oe/recipes-devtools/breakpad/breakpad/0003-Fix-conflict-between-musl-libc-dirent.h-and-lss.patch new file +35 -0
new file mode 100644
index 000000000..851004704
@@ -0,0 +1,35 @@
+From 7aa266545dabf9934ccd44d4fc836040497159be Mon Sep 17 00:00:00 2001
+From: Felix Janda <[email protected]>
+Date: Sun, 1 Feb 2015 13:41:08 +0100
+Subject: [PATCH 3/3] Fix conflict between musl libc <dirent.h> and lss
+
+Include <dirent.h> late to avoid the macro getdents64 in musl
+libc's <dirent.h> to conflict with linux_sycall_support.h.
+---
+ src/client/linux/crash_generation/crash_generation_server.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/client/linux/crash_generation/crash_generation_server.cc b/src/client/linux/crash_generation/crash_generation_server.cc
+index 26c50a5c..2596afde 100644
+--- a/src/client/linux/crash_generation/crash_generation_server.cc
++++ b/src/client/linux/crash_generation/crash_generation_server.cc
+@@ -28,7 +28,6 @@
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
+ #include <assert.h>
+-#include <dirent.h>
+ #include <fcntl.h>
+ #include <limits.h>
+ #include <poll.h>
+@@ -49,6 +48,8 @@
+ #include "common/linux/guid_creator.h"
+ #include "common/linux/safe_readlink.h"
+ 
++#include <dirent.h>
++
+ static const char kCommandQuit = 'x';
+ 
+ namespace google_breakpad {
+-- 
+2.14.1
+
meta-oe/recipes-devtools/breakpad/breakpad/0004-elf_reader.cc-include-sys-reg.h-to-get-__WORDSIZE-on.patch new file +43 -0

43 lines not on this page · raw message

meta-oe/recipes-devtools/breakpad/breakpad/0005-Import-necessary-definitions-from-stab.h.patch new file +199 -0

199 lines not on this page · raw message

meta-oe/recipes-devtools/breakpad/breakpad/0005-md2core-Replace-basename.patch new file +38 -0
new file mode 100644
index 000000000..852c1ed2c
@@ -0,0 +1,38 @@
+From bbf2b5ed5d93b227df8aea5726727b48e29f6790 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 14 Sep 2017 23:35:40 -0700
+Subject: [PATCH 5/5] md2core: Replace basename()
+
+musl does not provide it
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/tools/linux/md2core/minidump-2-core.cc | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/tools/linux/md2core/minidump-2-core.cc b/src/tools/linux/md2core/minidump-2-core.cc
+index 6a9e28eb..52b81c22 100644
+--- a/src/tools/linux/md2core/minidump-2-core.cc
++++ b/src/tools/linux/md2core/minidump-2-core.cc
+@@ -107,6 +107,9 @@ struct Options {
+ 
+ static void
+ Usage(int argc, const char* argv[]) {
++  const char *c_filename = argv[0];;
++  const char *p = strrchr(c_filename, '/');
++  const char *base = p ? p+1 : c_filename;
+   fprintf(stderr,
+           "Usage: %s [options] <minidump file>\n"
+           "\n"
+@@ -133,7 +136,7 @@ Usage(int argc, const char* argv[]) {
+           "             lookups to be done in this directory rather than the filesystem\n"
+           "             layout as it exists in the crashing image.  This path should end\n"
+           "             with a slash if it's a directory.  e.g. /var/lib/breakpad/\n"
+-          "", basename(argv[0]));
++          "", base);
+ }
+ 
+ static void
+-- 
+2.14.1
+
meta-oe/recipes-devtools/breakpad/breakpad_git.bb +13 -5
index a4f149143..9a1255594 100644
@@ -17,22 +17,30 @@ PE = "1"
 
 PV = "1.0+git${SRCPV}"
 
-SRCREV_FORMAT = "breakpad_glog_gtest_protobuf_lss_gyp"
+SRCREV_FORMAT = "breakpad_gtest_protobuf_lss_gyp"
 
-SRCREV_breakpad = "66856d617b6658ce09ef2bc1b15d457ab7b152b0"
-SRCREV_glog = "d8cb47f77d1c31779f3ff890e1a5748483778d6a"
+SRCREV_breakpad = "dea867e76f24e4a68395684b9d1cf24bcef82f20"
 SRCREV_gtest = "ec44c6c1675c25b9827aacd08c02433cccde7780"
 SRCREV_protobuf = "cb6dd4ef5f82e41e06179dcd57d3b1d9246ad6ac"
 SRCREV_lss = "a91633d172407f6c83dd69af11510b37afebb7f9"
-SRCREV_gyp = "e8ab0833a42691cd2184bd4c45d779e43821d3e0"
+SRCREV_gyp = "324dd166b7c0b39d513026fa52d6280ac6d56770"
 
 SRC_URI = "git://github.com/google/breakpad;name=breakpad \
-           git://github.com/google/glog.git;destsuffix=git/src/third_party/glog;name=glog \
            git://github.com/google/googletest.git;destsuffix=git/src/testing/gtest;name=gtest \
            git://github.com/google/protobuf.git;destsuffix=git/src/third_party/protobuf/protobuf;name=protobuf \
            git://chromium.googlesource.com/linux-syscall-support;protocol=https;destsuffix=git/src/third_party/lss;name=lss \
            git://chromium.googlesource.com/external/gyp;protocol=https;destsuffix=git/src/tools/gyp;name=gyp \
            file://0001-Replace-use-of-struct-ucontext-with-ucontext_t.patch \
+           file://0001-include-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch \
+           file://0002-Avoid-using-basename.patch \
+           file://0003-Fix-conflict-between-musl-libc-dirent.h-and-lss.patch \
+           file://0001-Turn-off-sign-compare-for-musl-libc.patch \
+           file://0002-sys-signal.h-is-a-nonportable-alias-for-signal.h.patch \
+           file://0003-Dont-include-stab.h.patch \
+           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://0001-lss-Match-syscalls-to-match-musl.patch;patchdir=src/third_party/lss \
 "
 S = "${WORKDIR}/git"
 
Signature · 1 line
2.14.1