From patchwork Tue Dec 18 21:04:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 1015625 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KBCHzjfF"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="TbsRchLE"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43K9Xp4HQpz9sBQ for ; Wed, 19 Dec 2018 08:05:46 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BmurAlQvsbhxqVsnjvWB8RpUmVR9ZkzIl7cJuTW3H2U=; b=KBCHzjfFdVBTWS jRz5C+svJ2BuSw6NFXMaLVqHvMFxIiyuxfBuOhcpigpAsawZL3LAgDWswO0EL0G11TYghgUWcBz+o V0kD2oAYOeVxovH5P20M0JVJbNQtBwgj3QMejd63bVD89wYBpNil1aWfJHDB97NU15PmHGHN4ypyu OAYinW6eZQrT1Pld0qXbMPyw9s75oC9sLH8CfytgsmGskeYODSYbMNYI0f2IL8bXs64RpxzMVIcxI uBtGRgKDOKzoiK1y/fYc6pL726B/iGeD1Y9Oh1gQU7m84rT01wbIzOoppgIVGrLibYc4/Z2HS8WGE vUie90kEOmYOnVlTbOkw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gZMYh-0001nL-Oe; Tue, 18 Dec 2018 21:05:43 +0000 Received: from smtprelay.synopsys.com ([198.182.47.9]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gZMYb-0001ga-8r for linux-snps-arc@lists.infradead.org; Tue, 18 Dec 2018 21:05:40 +0000 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 73C2224E27DD; Tue, 18 Dec 2018 13:05:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1545167131; bh=Fc9fyZhOH0L0U8+c5ToQGOnSp1XCRK57Jdb0ut+Jusk=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=TbsRchLEs+plsyr7vUiJq4JtNvaaF3JdtHntx+7y7xVeyooAclJ+mSP0Co/Ff18Uv 6ukqnNPn+fwbg5zhLPHJuq4B7VtLwzHSPwDE+NygAzGJqhgKOADqBx0+upj9woFjEp pWoWDx2YpsO2VhXpnnHb/Tz6jVwWuN32R1Hf5jVgcrx3J7p8KfCD7gAlMEiyYei6uh m6BZoWHwVJaUT2wjwN/p4AyjgAMUE/zuv+cbZsUDLRnphBxcOTBi+7cS6CL28SQ/fI N1GsQVbsdeORHgKYANAZ6MkaMc3ssC+HVfiW2q6v94QomxZZqN6VAE6JSbt9MKN1NH CmjuZ3Fs7/aeA== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2.internal.synopsys.com [10.12.239.237]) by mailhost.synopsys.com (Postfix) with ESMTP id 65E493BA6; Tue, 18 Dec 2018 13:05:31 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 18 Dec 2018 13:05:31 -0800 Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by IN01WEHTCA.internal.synopsys.com (10.144.199.103) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 02:35:30 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.10.161.70) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 19 Dec 2018 02:35:29 +0530 From: Vineet Gupta To: Subject: [PATCH 19/21] ARC: fix several unwining and cancelation tests Date: Tue, 18 Dec 2018 13:04:41 -0800 Message-ID: <1545167083-16764-20-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545167083-16764-1-git-send-email-vgupta@synopsys.com> References: <1545167083-16764-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.10.161.70] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181218_130537_347654_C13C4040 X-CRM114-Status: GOOD ( 18.14 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cupertino Miranda , Vineet Gupta , linux-snps-arc@lists.infradead.org Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Cupertino Miranda 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 Signed-off-by: Cupertino Miranda --- 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 * 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 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 #include -/* - * 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 + . */ + +#include +#include +#include + + nop +ENTRY(__default_rt_sa_restorer) + mov r8, __NR_rt_sigreturn + ARC_TRAP_INSN + j_s [blink] +PSEUDO_END_NOERRNO(__default_rt_sa_restorer)