From d14fb7f931dd8ef08c70dbb9946317cfd8704a0c Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Mon, 17 Apr 2017 19:34:17 +0200 Subject: libunwind: fix compile --- package/libunwind/patches/patch-Makefile_in | 2 +- .../libunwind/patches/patch-src_x86_Gos-linux_c | 39 +++++++++++++++++----- .../patches/patch-tests_test-coredump-unwind_c | 21 ++++++++++++ 3 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 package/libunwind/patches/patch-tests_test-coredump-unwind_c diff --git a/package/libunwind/patches/patch-Makefile_in b/package/libunwind/patches/patch-Makefile_in index 79eb9ab75..46c2d9d02 100644 --- a/package/libunwind/patches/patch-Makefile_in +++ b/package/libunwind/patches/patch-Makefile_in @@ -1,5 +1,5 @@ --- libunwind-1.2.orig/Makefile.in 2017-01-13 17:00:58.000000000 +0100 -+++ libunwind-1.2/Makefile.in 2017-04-17 16:57:53.104266427 +0200 ++++ libunwind-1.2/Makefile.in 2017-04-17 19:28:43.772508581 +0200 @@ -124,7 +124,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGE distdir dist dist-all distcheck ETAGS = etags diff --git a/package/libunwind/patches/patch-src_x86_Gos-linux_c b/package/libunwind/patches/patch-src_x86_Gos-linux_c index ecce53e4d..f5f3e53c5 100644 --- a/package/libunwind/patches/patch-src_x86_Gos-linux_c +++ b/package/libunwind/patches/patch-src_x86_Gos-linux_c @@ -1,14 +1,31 @@ --- libunwind-1.2.orig/src/x86/Gos-linux.c 2016-11-18 04:28:29.000000000 +0100 -+++ libunwind-1.2/src/x86/Gos-linux.c 2017-04-17 16:59:08.339188080 +0200 -@@ -290,19 +290,8 @@ x86_local_resume (unw_addr_space_t as, u - because the frame-chain still would let us do a backtrace at - least. */ - dwarf_make_proc_info (&c->dwarf); ++++ libunwind-1.2/src/x86/Gos-linux.c 2017-04-17 18:57:50.832552016 +0200 +@@ -26,6 +26,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE + #include "unwind_i.h" + #include "offsets.h" + ++#include ++ + PROTECTED int + unw_is_signal_frame (unw_cursor_t *cursor) + { +@@ -283,26 +285,16 @@ HIDDEN int + x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) + { + struct cursor *c = (struct cursor *) cursor; +- ucontext_t *uc = c->uc; +- +- /* Ensure c->pi is up-to-date. On x86, it's relatively common to be +- missing DWARF unwind info. We don't want to fail in that case, +- because the frame-chain still would let us do a backtrace at +- least. */ +- dwarf_make_proc_info (&c->dwarf); - - if (unlikely (c->sigcontext_format != X86_SCF_NONE)) - { - struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; -- ++ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; + - Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc); - sigreturn (sc); - } @@ -17,8 +34,14 @@ - Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip); - setcontext (uc); - } -+ Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip); -+ setcontext (uc); ++ Debug (8, "resuming at ip=%llx via sigreturn(%p)\n", ++ (unsigned long long) c->dwarf.ip, sc); ++ __asm__ __volatile__ ( ++ "int $0x80" ++ : "=r" (sc) ++ : "0"(SYS_rt_sigreturn) ++ : "memory" ++ ); return -UNW_EINVAL; } #endif diff --git a/package/libunwind/patches/patch-tests_test-coredump-unwind_c b/package/libunwind/patches/patch-tests_test-coredump-unwind_c new file mode 100644 index 000000000..640ae9c3b --- /dev/null +++ b/package/libunwind/patches/patch-tests_test-coredump-unwind_c @@ -0,0 +1,21 @@ +--- libunwind-1.2.orig/tests/test-coredump-unwind.c 2017-01-13 16:58:24.000000000 +0100 ++++ libunwind-1.2/tests/test-coredump-unwind.c 2017-04-17 18:52:13.963470134 +0200 +@@ -57,7 +57,9 @@ + #include + + /* For SIGSEGV handler code */ ++#ifndef __UCLIBC__ + #include ++#endif + #include + + #include +@@ -242,7 +244,7 @@ void handle_sigsegv(int sig, siginfo_t * + void *array[50]; + int size; + size = backtrace(array, 50); +-#ifdef __linux__ ++#if defined __linux__ && !defined __UCLIBC__ + backtrace_symbols_fd(array, size, 2); + #endif + } -- cgit v1.2.3