diff mbox

question about x86 portability issues

Message ID 20170417151036.GF11446@waldemar-brodkorb.de
State Not Applicable
Headers show

Commit Message

Waldemar Brodkorb April 17, 2017, 3:10 p.m. UTC
Hi developers,

with Buildroot we have some compile issues when using uClibc-ng or
musl toolchains. The reason is the x86 specific code is using 
deprecated sigreturn and setcontext functions.

With the attached patch I could compile libunwind with the uClibc-ng
toolchain.

But the best solution would be if the code would use a direct
syscall to rt_sigreturn as the x86_64 code does:
http://git.savannah.gnu.org/gitweb/?p=libunwind.git;a=blob;f=src/x86_64/Gos-linux.c;h=6f70d3ffdb1e514a567d0c2146c852765bda953d;hb=HEAD#l148

What do you think?

I think sigreturn() is a noop in GNU C Library for x86 and x86_64.

Thanks,
 Waldemar
diff mbox

Patch

From e74841ce2e1eba82746ab1fa49949bc93844b49e Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Mon, 17 Apr 2017 17:01:34 +0200
Subject: [PATCH] x86: do not use deprecated sigreturn

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 src/x86/Gos-linux.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/x86/Gos-linux.c b/src/x86/Gos-linux.c
index 17aebc2..b7e7e94 100644
--- a/src/x86/Gos-linux.c
+++ b/src/x86/Gos-linux.c
@@ -290,19 +290,8 @@  x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
      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;
-
-      Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc);
-      sigreturn (sc);
-    }
-  else
-    {
-      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);
   return -UNW_EINVAL;
 }
 #endif
-- 
2.1.4