diff options
3 files changed, 58 insertions, 48 deletions
diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0001-Remove-HAVE_GETCONTEXT-check-to-add-local-implementa.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0001-Remove-HAVE_GETCONTEXT-check-to-add-local-implementa.patch new file mode 100644 index 0000000000..d7a5c06753 --- /dev/null +++ b/meta-oe/recipes-devtools/breakpad/breakpad/0001-Remove-HAVE_GETCONTEXT-check-to-add-local-implementa.patch | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | From 70441611d4e8200d9d16dfed493873b8c1bb57c5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 15 Mar 2021 11:33:38 -0700 | ||
| 4 | Subject: [PATCH] Remove HAVE_GETCONTEXT check to add local implementation | ||
| 5 | |||
| 6 | On musl getcontext/setcontext APIs are implemented in libucontext which | ||
| 7 | can be used | ||
| 8 | |||
| 9 | Upstream-Status: Inappropriate [Musl Specific] | ||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | Makefile.am | 12 ------------ | ||
| 13 | 1 file changed, 12 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/Makefile.am b/Makefile.am | ||
| 16 | index ee7454e4..69700192 100644 | ||
| 17 | --- a/Makefile.am | ||
| 18 | +++ b/Makefile.am | ||
| 19 | @@ -187,10 +187,6 @@ src_client_linux_libbreakpad_client_a_SOURCES = \ | ||
| 20 | src/common/linux/linux_libc_support.cc \ | ||
| 21 | src/common/linux/memory_mapped_file.cc \ | ||
| 22 | src/common/linux/safe_readlink.cc | ||
| 23 | -if !HAVE_GETCONTEXT | ||
| 24 | -src_client_linux_libbreakpad_client_a_SOURCES += \ | ||
| 25 | - src/common/linux/breakpad_getcontext.S | ||
| 26 | -endif | ||
| 27 | endif LINUX_HOST | ||
| 28 | |||
| 29 | if !DISABLE_PROCESSOR | ||
| 30 | @@ -508,10 +504,6 @@ src_client_linux_linux_client_unittest_shlib_SOURCES = \ | ||
| 31 | src/processor/minidump.cc \ | ||
| 32 | src/processor/pathname_stripper.cc \ | ||
| 33 | src/processor/proc_maps_linux.cc | ||
| 34 | -if !HAVE_GETCONTEXT | ||
| 35 | -src_client_linux_linux_client_unittest_shlib_SOURCES += \ | ||
| 36 | - src/common/linux/breakpad_getcontext.S | ||
| 37 | -endif | ||
| 38 | |||
| 39 | src_client_linux_linux_client_unittest_shlib_CPPFLAGS = \ | ||
| 40 | $(AM_CPPFLAGS) $(TEST_CFLAGS) | ||
| 41 | @@ -541,10 +533,6 @@ src_client_linux_linux_client_unittest_shlib_LDADD = \ | ||
| 42 | src/common/string_conversion.o \ | ||
| 43 | $(TEST_LIBS) \ | ||
| 44 | $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) | ||
| 45 | -if !HAVE_GETCONTEXT | ||
| 46 | -src_client_linux_linux_client_unittest_shlib_SOURCES += \ | ||
| 47 | - src/common/linux/breakpad_getcontext_unittest.cc | ||
| 48 | -endif | ||
| 49 | if ANDROID_HOST | ||
| 50 | src_client_linux_linux_client_unittest_shlib_LDFLAGS += \ | ||
| 51 | -llog -lm | ||
| 52 | -- | ||
| 53 | 2.30.2 | ||
| 54 | |||
diff --git a/meta-oe/recipes-devtools/breakpad/breakpad/0001-disable-calls-to-getcontext-with-musl.patch b/meta-oe/recipes-devtools/breakpad/breakpad/0001-disable-calls-to-getcontext-with-musl.patch deleted file mode 100644 index 466abe5f87..0000000000 --- a/meta-oe/recipes-devtools/breakpad/breakpad/0001-disable-calls-to-getcontext-with-musl.patch +++ /dev/null | |||
| @@ -1,47 +0,0 @@ | |||
| 1 | From 57ecf7205feedd23f901e1bb9d193787e559e433 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andre McCurdy <armccurdy@gmail.com> | ||
| 3 | Date: Tue, 23 Jan 2018 15:13:26 -0800 | ||
| 4 | Subject: [PATCH] disable calls to getcontext() with musl | ||
| 5 | |||
| 6 | Signed-off-by: Andre McCurdy <armccurdy@gmail.com> | ||
| 7 | --- | ||
| 8 | src/client/linux/handler/exception_handler.cc | 17 +++++++++++++++++ | ||
| 9 | 1 file changed, 17 insertions(+) | ||
| 10 | |||
| 11 | --- a/src/client/linux/handler/exception_handler.cc | ||
| 12 | +++ b/src/client/linux/handler/exception_handler.cc | ||
| 13 | @@ -490,7 +490,19 @@ bool ExceptionHandler::SimulateSignalDel | ||
| 14 | siginfo.si_code = SI_USER; | ||
| 15 | siginfo.si_pid = getpid(); | ||
| 16 | ucontext_t context; | ||
| 17 | +#if defined(__GLIBC__) | ||
| 18 | getcontext(&context); | ||
| 19 | +#else | ||
| 20 | + // Extreme hack: Allow musl builds to compile - but don't expect them to work. | ||
| 21 | + // Although musl provides a definition for getcontext() in ucontext.h (which | ||
| 22 | + // enough to build libbreakpad_client) musl does not provide a corresponding | ||
| 23 | + // getcontext() function, so builds will fail when attempting to link anything | ||
| 24 | + // with libbreakpad_client. Disabling calls to getcontext() is a temporary | ||
| 25 | + // hack. The real fix is probably to enable Breakpad's own implementation of | ||
| 26 | + // getcontext() when building for musl (it's currently only enabled when | ||
| 27 | + // building for Android). | ||
| 28 | + memset (&context, 0, sizeof(context)); | ||
| 29 | +#endif | ||
| 30 | return HandleSignal(sig, &siginfo, &context); | ||
| 31 | } | ||
| 32 | |||
| 33 | @@ -675,9 +687,14 @@ bool ExceptionHandler::WriteMinidump() { | ||
| 34 | sys_prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); | ||
| 35 | |||
| 36 | CrashContext context; | ||
| 37 | +#if defined(__GLIBC__) | ||
| 38 | int getcontext_result = getcontext(&context.context); | ||
| 39 | if (getcontext_result) | ||
| 40 | return false; | ||
| 41 | +#else | ||
| 42 | + // Extreme hack - see comments above. | ||
| 43 | + memset (&context.context, 0, sizeof(context.context)); | ||
| 44 | +#endif | ||
| 45 | |||
| 46 | #if defined(__i386__) | ||
| 47 | // In CPUFillFromUContext in minidumpwriter.cc the stack pointer is retrieved | ||
diff --git a/meta-oe/recipes-devtools/breakpad/breakpad_git.bb b/meta-oe/recipes-devtools/breakpad/breakpad_git.bb index 4d9038a92c..81955f450d 100644 --- a/meta-oe/recipes-devtools/breakpad/breakpad_git.bb +++ b/meta-oe/recipes-devtools/breakpad/breakpad_git.bb | |||
| @@ -11,6 +11,8 @@ SECTION = "libs" | |||
| 11 | 11 | ||
| 12 | inherit autotools | 12 | inherit autotools |
| 13 | 13 | ||
| 14 | DEPENDS_append_libc-musl = " libucontext" | ||
| 15 | |||
| 14 | BBCLASSEXTEND = "native" | 16 | BBCLASSEXTEND = "native" |
| 15 | 17 | ||
| 16 | PE = "2" | 18 | PE = "2" |
| @@ -37,7 +39,7 @@ SRC_URI = "git://github.com/google/breakpad;name=breakpad;branch=main \ | |||
| 37 | file://0003-Dont-include-stab.h.patch \ | 39 | file://0003-Dont-include-stab.h.patch \ |
| 38 | file://0004-elf_reader.cc-include-sys-reg.h-to-get-__WORDSIZE-on.patch \ | 40 | file://0004-elf_reader.cc-include-sys-reg.h-to-get-__WORDSIZE-on.patch \ |
| 39 | file://mcontext.patch \ | 41 | file://mcontext.patch \ |
| 40 | file://0001-disable-calls-to-getcontext-with-musl.patch \ | 42 | file://0001-Remove-HAVE_GETCONTEXT-check-to-add-local-implementa.patch \ |
| 41 | file://0001-lss-Match-syscalls-to-match-musl.patch;patchdir=src/third_party/lss \ | 43 | file://0001-lss-Match-syscalls-to-match-musl.patch;patchdir=src/third_party/lss \ |
| 42 | file://mips_asm_sgidefs.patch;patchdir=src/third_party/lss \ | 44 | file://mips_asm_sgidefs.patch;patchdir=src/third_party/lss \ |
| 43 | file://0001-Do-not-add-stack-pointer-to-clobber-list.patch;patchdir=src/third_party/lss \ | 45 | file://0001-Do-not-add-stack-pointer-to-clobber-list.patch;patchdir=src/third_party/lss \ |
| @@ -45,6 +47,7 @@ SRC_URI = "git://github.com/google/breakpad;name=breakpad;branch=main \ | |||
| 45 | S = "${WORKDIR}/git" | 47 | S = "${WORKDIR}/git" |
| 46 | 48 | ||
| 47 | CXXFLAGS += "-D_GNU_SOURCE" | 49 | CXXFLAGS += "-D_GNU_SOURCE" |
| 50 | LDFLAGS_append_libc-musl = " -lucontext" | ||
| 48 | 51 | ||
| 49 | COMPATIBLE_HOST_powerpc = "null" | 52 | COMPATIBLE_HOST_powerpc = "null" |
| 50 | COMPATIBLE_HOST_powerpc64 = "null" | 53 | COMPATIBLE_HOST_powerpc64 = "null" |
