All of lore.kernel.org
 help / color / mirror / Atom feed
From: vineet.gupta1@synopsys.com (Vineet Gupta)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH 19/21] ARC: fix several unwining and cancelation tests
Date: Tue, 18 Dec 2018 13:04:41 -0800	[thread overview]
Message-ID: <1545167083-16764-20-git-send-email-vgupta@synopsys.com> (raw)
In-Reply-To: <1545167083-16764-1-git-send-email-vgupta@synopsys.com>

From: Cupertino Miranda <cmiranda@synopsys.com>

1. Add dwarf CFI psuedo-ops to various syscall generators

2. Signature of sa_restorer was not what libgcc trampoline parser
   expects due to an intermediate mov instruction

Signed-off-by: Vineet Gupta <vgupta at synopsys.com>
Signed-off-by: Cupertino Miranda <cmiranda at synopsys.com>
---
 ChangeLog                                 |  8 ++++++++
 sysdeps/arc/dl-trampoline.S               |  9 +++++++++
 sysdeps/arc/sysdep.h                      |  2 ++
 sysdeps/unix/sysv/linux/arc/Makefile      |  4 ++++
 sysdeps/unix/sysv/linux/arc/Versions      |  4 ++++
 sysdeps/unix/sysv/linux/arc/sigaction.c   |  8 +-------
 sysdeps/unix/sysv/linux/arc/sigrestorer.S | 28 ++++++++++++++++++++++++++++
 7 files changed, 56 insertions(+), 7 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/arc/sigrestorer.S

diff --git a/ChangeLog b/ChangeLog
index ec068c7c5925..376d0e401117 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
 2018-12-17  Cupertino Miranda <cmiranda at synopsys.com>
 
 	* sysdeps/arc/dl-machine.h: Fix relocation.
+	* sysdeps/arc/dl-trampoline.S: Add cfi pseudo-ops.
+	* sysdeps/arc/sysdep.h: likewise.
+	* sysdeps/unix/sysv/linux/arc/sigrestorer.S: Add default sa_restorer
+	in asm.
+	* sysdeps/unix/sysv/linux/arc/sigaction.c: Delete "C" version of
+	restorer.
+	* sysdeps/unix/sysv/linux/arc/Makefile: Enable build.
+	* sysdeps/unix/sysv/linux/arc/Versions: expose default sa_restorer.
 
 2018-12-17  Vineet Gupta <vgupta at synopsys.com>
 
diff --git a/sysdeps/arc/dl-trampoline.S b/sysdeps/arc/dl-trampoline.S
index c704f0ff9a95..0fc9786ec1d3 100644
--- a/sysdeps/arc/dl-trampoline.S
+++ b/sysdeps/arc/dl-trampoline.S
@@ -37,11 +37,16 @@
 	st.a	r7, [sp, -4]
 	st.a	r8, [sp, -4]
 	st.a	r9, [sp, -4]
+	cfi_adjust_cfa_offset (40)
 	push_s	blink
+	cfi_adjust_cfa_offset (4)
+	cfi_rel_offset (blink, 0)
 .endm
 
 .macro RESTORE_CALLER_SAVED_BUT_R0
 	ld.ab	blink,[sp, 4]
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (blink)
 	ld.ab	r9, [sp, 4]
 	ld.ab	r8, [sp, 4]
 	ld.ab	r7, [sp, 4]
@@ -51,6 +56,7 @@
 	pop_s   r3
 	pop_s   r2
 	pop_s   r1
+	cfi_adjust_cfa_offset (-36)
 .endm
 
 ; Upon entry, PLTn, which led us here, sets up the following regs
@@ -69,4 +75,7 @@ ENTRY(_dl_runtime_resolve)
 	RESTORE_CALLER_SAVED_BUT_R0
 	j_s.d   [r0]    ; r0 has resolved function addr
 	pop_s   r0      ; restore first arg to resolved call
+	cfi_adjust_cfa_offset (-4)
+	cfi_restore (r0)
+
 END(_dl_runtime_resolve)
diff --git a/sysdeps/arc/sysdep.h b/sysdeps/arc/sysdep.h
index 5c6e063d03fe..920611277089 100644
--- a/sysdeps/arc/sysdep.h
+++ b/sysdeps/arc/sysdep.h
@@ -32,10 +32,12 @@
     .globl C_SYMBOL_NAME(name)			ASM_LINE_SEP	\
     .type C_SYMBOL_NAME(name),%function		ASM_LINE_SEP	\
   C_LABEL(name)					ASM_LINE_SEP	\
+    cfi_startproc				ASM_LINE_SEP	\
     CALL_MCOUNT
 
 #undef  END
 #define END(name)						\
+  cfi_endproc					ASM_LINE_SEP	\
   ASM_SIZE_DIRECTIVE(name)
 
 #ifdef SHARED
diff --git a/sysdeps/unix/sysv/linux/arc/Makefile b/sysdeps/unix/sysv/linux/arc/Makefile
index 76e5d24daea2..a6c6dfc6ec64 100644
--- a/sysdeps/unix/sysv/linux/arc/Makefile
+++ b/sysdeps/unix/sysv/linux/arc/Makefile
@@ -2,6 +2,10 @@ ifeq ($(subdir),stdlib)
 gen-as-const-headers += ucontext_i.sym
 endif
 
+ifeq ($(subdir),signal)
+sysdep_routines += sigrestorer
+endif
+
 ifeq ($(subdir),misc)
 # MIPS/Tile-style cacheflush routine
 sysdep_headers += sys/cachectl.h
diff --git a/sysdeps/unix/sysv/linux/arc/Versions b/sysdeps/unix/sysv/linux/arc/Versions
index ac3327426360..3d12161f7fe2 100644
--- a/sysdeps/unix/sysv/linux/arc/Versions
+++ b/sysdeps/unix/sysv/linux/arc/Versions
@@ -9,4 +9,8 @@ libc {
     _flush_cache;
     cacheflush;
   }
+  GLIBC_PRIVATE {
+    # A copy of sigaction lives in libpthread, and needs these.
+    __default_rt_sa_restorer;
+  }
 }
diff --git a/sysdeps/unix/sysv/linux/arc/sigaction.c b/sysdeps/unix/sysv/linux/arc/sigaction.c
index 0a58e78f8834..b437af677d58 100644
--- a/sysdeps/unix/sysv/linux/arc/sigaction.c
+++ b/sysdeps/unix/sysv/linux/arc/sigaction.c
@@ -22,13 +22,7 @@
 #include <string.h>
 #include <sys/syscall.h>
 
-/*
- * Default sigretrun stub if user doesn't specify SA_RESTORER
- */
-static void __default_rt_sa_restorer(void)
-{
-	INTERNAL_SYSCALL_NCS(__NR_rt_sigreturn, , 0);
-}
+extern void __default_rt_sa_restorer(void);
 
 #define SA_RESTORER	0x04000000
 
diff --git a/sysdeps/unix/sysv/linux/arc/sigrestorer.S b/sysdeps/unix/sysv/linux/arc/sigrestorer.S
new file mode 100644
index 000000000000..d74cf0ec00e3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arc/sigrestorer.S
@@ -0,0 +1,28 @@
+/* Default sigreturn stub for ARC Linux.
+   Copyright (C) 2005-2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sys/syscall.h>
+#include <sysdep.h>
+#include <tcb-offsets.h>
+
+	nop
+ENTRY(__default_rt_sa_restorer)
+	mov r8, __NR_rt_sigreturn
+	ARC_TRAP_INSN
+	j_s     [blink]
+PSEUDO_END_NOERRNO(__default_rt_sa_restorer)
-- 
2.7.4

  parent reply	other threads:[~2018-12-18 21:04 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 21:04 [PATCH 00/21] glibc port to ARC processors Vineet Gupta
2018-12-18 21:04 ` [PATCH 01/21] longlong.h: sync from gcc to fix ARC inline asm constraints Vineet Gupta
2018-12-18 22:56   ` Joseph Myers
2018-12-18 23:11     ` Vineet Gupta
2018-12-21 18:46   ` Joseph Myers
2018-12-21 19:07     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 02/21] ARC: add definitions to elf/elf.h Vineet Gupta
2018-12-18 21:04 ` [PATCH 03/21] ARC: ABI Implementation Vineet Gupta
2018-12-18 23:09   ` Joseph Myers
2018-12-19  2:00     ` Vineet Gupta
2018-12-19 17:40       ` Joseph Myers
2018-12-19 20:20         ` Vineet Gupta
2018-12-19 20:37           ` Joseph Myers
2019-01-28 23:03     ` ARC binutils init/fini (was Re: [PATCH 03/21] ARC: ABI Implementation) Vineet Gupta
2019-01-28 23:13       ` Joseph Myers
2019-01-28 23:42         ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 04/21] ARC: startup and dynamic linking code Vineet Gupta
2018-12-18 23:24   ` Joseph Myers
2018-12-19  0:52     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 05/21] ARC: Thread Local Storage support Vineet Gupta
2018-12-18 21:04 ` [PATCH 06/21] ARC: Atomics and Locking primitives Vineet Gupta
2018-12-18 23:15   ` Joseph Myers
2019-01-15  0:40     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 07/21] ARC: math soft float support Vineet Gupta
2018-12-18 23:23   ` Joseph Myers
2018-12-19  0:01     ` Joseph Myers
2018-12-20 21:35       ` Vineet Gupta
2018-12-21  1:08     ` Vineet Gupta
2018-12-21  1:19       ` Joseph Myers
2018-12-18 21:04 ` [PATCH 08/21] ARC: Linux Syscall Interface Vineet Gupta
2018-12-18 23:30   ` Joseph Myers
2018-12-19  2:39     ` Vineet Gupta
2018-12-19 17:58       ` ARC vs. generic sigaction (was Re: [PATCH 08/21] ARC: Linux Syscall Interface) Vineet Gupta
2018-12-19 18:07         ` Joseph Myers
2018-12-19 22:00         ` Adhemerval Zanella
2018-12-19 22:23           ` Vineet Gupta
2018-12-20 11:19             ` Adhemerval Zanella
2018-12-20 12:06               ` Arnd Bergmann
2018-12-20 19:25                 ` Vineet Gupta
2018-12-20 12:40               ` Florian Weimer
2018-12-20 18:48                 ` Vineet Gupta
2019-01-03 13:10                   ` Florian Weimer
2018-12-20 19:23               ` Vineet Gupta
2018-12-20 20:06                 ` Adhemerval Zanella
2018-12-20 20:46                   ` Vineet Gupta
2018-12-21 12:05                     ` Adhemerval Zanella
2019-01-09 21:49                       ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 09/21] ARC: Linux ABI Vineet Gupta
2018-12-18 23:38   ` Joseph Myers
2018-12-19 19:57     ` Vineet Gupta
2018-12-19 20:36       ` Joseph Myers
2018-12-21 23:06         ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 10/21] ARC: Linux Startup and Dynamic Loading Vineet Gupta
2018-12-18 23:49   ` Joseph Myers
2018-12-19 20:26     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 11/21] ARC: ABI lists Vineet Gupta
2018-12-18 22:31   ` Andreas Schwab
2018-12-18 22:32     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 12/21] ARC: Update syscall-names.list for ARC specific syscalls Vineet Gupta
2018-12-18 21:26   ` Florian Weimer
2018-12-18 21:29     ` Vineet Gupta
2018-12-19  8:16       ` Florian Weimer
2018-12-18 21:04 ` [PATCH 13/21] ARC: Build Infrastructure Vineet Gupta
2018-12-18 23:44   ` Joseph Myers
2018-12-19 21:58     ` Vineet Gupta
2018-12-19 22:17       ` Joseph Myers
2018-12-20 23:21         ` Vineet Gupta
2018-12-20 23:24           ` Joseph Myers
2019-01-29 23:36             ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 14/21] ARC: Enable __start as entry point vs. canonical _start Vineet Gupta
2018-12-18 21:28   ` Florian Weimer
2018-12-18 21:31     ` Vineet Gupta
2018-12-18 22:59       ` Joseph Myers
2018-12-18 23:08         ` Vineet Gupta
2018-12-19 20:36     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 15/21] ARC: testsuite fix: elf/check-initfini Vineet Gupta
2018-12-18 21:04 ` [PATCH 16/21] ARC: testsuite fix: sysvipc/* Vineet Gupta
2018-12-18 21:04 ` [PATCH 17/21] ARC: testsuite fix: stdlib/tst-makecontext Vineet Gupta
2018-12-18 22:36   ` Andreas Schwab
2019-01-21 22:32     ` Vineet Gupta
2018-12-18 21:04 ` [PATCH 18/21] ARC: testsuite fix: GD TLS issue Vineet Gupta
2018-12-18 21:04 ` Vineet Gupta [this message]
2018-12-18 21:04 ` [PATCH 20/21] build-many-glibcs.py: Enable ARC builds Vineet Gupta
2018-12-18 21:04 ` [PATCH 21/21] NEWS: mention ARC port Vineet Gupta
2018-12-18 23:45   ` Joseph Myers
2018-12-19 18:30     ` Vineet Gupta
2018-12-18 22:52 ` [PATCH 00/21] glibc port to ARC processors Joseph Myers
2018-12-18 23:07   ` Vineet Gupta
2018-12-18 23:52     ` Joseph Myers
2018-12-21  1:55       ` Vineet Gupta
2018-12-21 14:32         ` Joseph Myers
2018-12-21 17:36           ` Vineet Gupta
2018-12-18 23:11 ` Joseph Myers
2018-12-19 23:45   ` Vineet Gupta
2018-12-20  0:14     ` Joseph Myers
2018-12-20  0:51       ` Vineet Gupta
2018-12-20 21:22 ` test related questions (was Re: [PATCH 00/21] glibc port to ARC processors) Vineet Gupta
2018-12-20 21:59   ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1545167083-16764-20-git-send-email-vgupta@synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=linux-snps-arc@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.