1From 0b2243f19d4ea12a2a68478a5aed503947a800af Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 22 Mar 2016 16:19:29 +0000
4Subject: [PATCH] x86: Stub out x86_local_resume()
5
6its purpose seems
7to be unwinding across signal handler boundaries, which cannot happen
8in correct programs anyway. Replacing the whole function with
9something like *(volatile char *)0=0; (i.e. crash), gets a working
10libunwind
11
12Upstream-Status: Pending
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14
15---
16 src/x86/Gos-linux.c | 26 +-------------------------
17 1 file changed, 1 insertion(+), 25 deletions(-)
18
19diff --git a/src/x86/Gos-linux.c b/src/x86/Gos-linux.c
20index d448dce..c25ae0c 100644
21--- a/src/x86/Gos-linux.c
22+++ b/src/x86/Gos-linux.c
23@@ -284,31 +284,7 @@ x86_r_uc_addr (ucontext_t *uc, int reg)
24 HIDDEN int
25 x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
26 {
27-  struct cursor *c = (struct cursor *) cursor;
28-  ucontext_t *uc = c->uc;
29-
30-  /* Ensure c->pi is up-to-date.  On x86, it's relatively common to be
31-     missing DWARF unwind info.  We don't want to fail in that case,
32-     because the frame-chain still would let us do a backtrace at
33-     least.  */
34-  dwarf_make_proc_info (&c->dwarf);
35-
36-  if (unlikely (c->sigcontext_format != X86_SCF_NONE))
37-    {
38-      struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr;
39-
40-      Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc);
41-#if !defined(__ANDROID__)
42-      x86_sigreturn (sc);
43-#endif
44-    }
45-  else
46-    {
47-      Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip);
48-#if !defined(__ANDROID__)
49-      setcontext (uc);
50-#endif
51-    }
52+  *(volatile char *)0=0;
53   return -UNW_EINVAL;
54 }
55
56