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