From patchwork Tue Jun 27 08:00:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 781059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 3wxdx46N3dz9s5L for ; Tue, 27 Jun 2017 18:14:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XvgJbSah"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="BRMa7JAA"; dkim-atps=neutral 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=5XodPBQ/zdUWBMQipDnySG6Rk0YWsiydElSIK10kvsE=; b=XvgJbSahB5aJD4 yeBkmm5vWadIKVVX+zqomeYNlM6jL8NKtL3OhsjMC8zrXdIy1fKfaTS8g3IPOR5DKAiGEixXt33JF Q5OOdDE4M+dD0S0zyBef6zxJ1C2kd6ydo0Ti/Bofjc2bJB9uaRaXxJ9z2VkVjp5xbqeKUmf92niyS UJmJbXHJHPR7pv7+e5YLybBytI7zFEoVQfzUaPOdyIVKlfwMJIh9XBmEwhi0iTN3YN61GXlOuVp3o d//aXExAMy1V7pQCz56HszFFHkd+RxGHg0rdtrhdsUvYG92TyIJ+TDdNswNsPjp98GfnxGEF5Touc 7cHgQduvhMvlb6TKMPBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dPldH-0004FY-IT; Tue, 27 Jun 2017 08:13:59 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dPldF-0004C2-E3 for linux-snps-arc@bombadil.infradead.org; Tue, 27 Jun 2017 08:13:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+vWVoCDWMAYzy26Lhl29JLRxvLWqV+1jlCL7w9ZfZSg=; b=BRMa7JAA/qtYc0YjTEEZIxoR+ dlSPJH15mB9D2lCRKjH7tWVeshnNjpg/CYEc3bDSiXWOQ17c8TtlrDViYgnI7odls+RUbH8wYP2Dx SIH7IiGz1aXAv6OnR7ophSaRHyqD6YTeEbku3A4vTpfBzdMQn1NGSadHT2c81JYOh5ymjFK3YWDJp nrGBe/nXRMN2m2gseKJLdGO/laufIAfpezBNRAnPLNRtO9WCEwHSTJJbdHJhkdvbePq6EMIo6aPoT 62uruaQHAxk4CAKaSbhxy4ZnPU6SnnKPEhdOYrP3+FmKmEZr0cNLh7H+mpBzDid0TEWxZcD/b+7DV hn8POm/Mg==; Received: from us01smtprelay-2.synopsys.com ([198.182.60.111] helo=smtprelay.synopsys.com) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dPlRi-00016N-TV for linux-snps-arc@lists.infradead.org; Tue, 27 Jun 2017 08:02:08 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 7CDC110C1662; Tue, 27 Jun 2017 01:01:42 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 5F65CC90; Tue, 27 Jun 2017 01:01:42 -0700 (PDT) Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2-vip.internal.synopsys.com [10.12.239.238]) by mailhost.synopsys.com (Postfix) with ESMTP id 4D949C8E; Tue, 27 Jun 2017 01:01:42 -0700 (PDT) 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.266.1; Tue, 27 Jun 2017 01:01:42 -0700 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.266.1; Tue, 27 Jun 2017 13:31:31 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.121.3.13) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Tue, 27 Jun 2017 13:31:30 +0530 From: Vineet Gupta To: "libc-alpha @ sourceware . org" Subject: [RFC 6/6] ARC: Fix several testsuite failures related to unwinding Date: Tue, 27 Jun 2017 11:00:54 +0300 Message-ID: <1498550454-3560-7-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498550454-3560-1-git-send-email-vgupta@synopsys.com> References: <1498550454-3560-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.121.3.13] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170627_090205_120641_1CD86F4A X-CRM114-Status: UNSURE ( 9.37 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.60.111 listed in list.dnswl.org] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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@synopsys.com, 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 BLINK clobber to syscall wrappers allowing unwinding off of sleeping syscalls (this is arguably excessive, give it is not needed except for a handful of slow syscalls such as read/write/nanosleep...) 2. Rework sigreturn to undo above since we don't want BLINK spilled on stack for this specific case 3. Add dwarf CFI psuedo-ops to various syscall generators Signed-off-by: Cupertino Miranda Signed-off-by: Vineet Gupta --- sysdeps/arc/dl-trampoline.S | 9 +++++++++ sysdeps/arc/sysdep.h | 2 ++ sysdeps/unix/sysv/linux/arc/sigaction.c | 7 ++++++- sysdeps/unix/sysv/linux/arc/sysdep-cancel.h | 4 ++++ sysdeps/unix/sysv/linux/arc/sysdep.h | 12 ++++++++---- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/sysdeps/arc/dl-trampoline.S b/sysdeps/arc/dl-trampoline.S index 0e781af8380e..06fd7ff9a667 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 d57f1c0c60a4..c4495bd877c9 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/sigaction.c b/sysdeps/unix/sysv/linux/arc/sigaction.c index 2bd7b0f08ddc..e2b898039df1 100644 --- a/sysdeps/unix/sysv/linux/arc/sigaction.c +++ b/sysdeps/unix/sysv/linux/arc/sigaction.c @@ -26,7 +26,12 @@ */ static void __default_rt_sa_restorer(void) { - INTERNAL_SYSCALL_NCS(__NR_rt_sigreturn, , 0); + /* Don't use INTERNAL_SYSCALL_NCS as it causes blink to be spilled on stack */ + asm volatile( + "mov r8, %0 \n\t" \ + ARC_TRAP_INSN \ + : + : "r"(__NR_rt_sigreturn)); } #define SA_RESTORER 0x04000000 diff --git a/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h b/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h index db89ad033a79..b2dbb8670874 100644 --- a/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h +++ b/sysdeps/unix/sysv/linux/arc/sysdep-cancel.h @@ -83,10 +83,14 @@ .macro PUSH reg st.a \reg, [sp, -4] + cfi_adjust_cfa_offset (4) + cfi_rel_offset (\reg, 0) .endm .macro POP reg ld.ab \reg, [sp, 4] + cfi_adjust_cfa_offset (-4) + cfi_restore (\reg) .endm #define DOCARGS_0 PUSH blink diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h index 507d06a8a575..492a709b51fd 100644 --- a/sysdeps/unix/sysv/linux/arc/sysdep.h +++ b/sysdeps/unix/sysv/linux/arc/sysdep.h @@ -103,8 +103,12 @@ # define SYSCALL_ERROR_HANDLER \ 0: ASM_LINE_SEP \ st.a blink, [sp, -4] ASM_LINE_SEP \ + cfi_adjust_cfa_offset (4) ASM_LINE_SEP \ + cfi_rel_offset (blink, 0) ASM_LINE_SEP \ CALL_ERRNO_SETTER_C ASM_LINE_SEP \ ld.ab blink, [sp, 4] ASM_LINE_SEP \ + cfi_adjust_cfa_offset (-4) ASM_LINE_SEP \ + cfi_restore (blink) ASM_LINE_SEP \ j [blink] # define DO_CALL(syscall_name, args) \ @@ -137,13 +141,13 @@ hidden_proto (__syscall_error) __res = INTERNAL_SYSCALL_NCS(__NR_##name, , nr_args, args); \ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P ((__res), ), 0)) \ { \ - asm volatile ("st.a blink, [sp, -4] \n\t" \ + asm volatile ( \ CALL_ERRNO_SETTER \ - "ld.ab blink, [sp, 4] \n\t" \ :"+r" (__res) \ : \ :"r1","r2","r3","r4","r5","r6", \ - "r7","r8","r9","r10","r11","r12"); \ + "r7","r8","r9","r10","r11","r12", \ + "blink"); \ } \ __res; \ }) @@ -174,7 +178,7 @@ hidden_proto (__syscall_error) ARC_TRAP_INSN \ : "+r" (__ret) \ : "r"(_sys_num) ASM_ARGS_##nr_args \ - : "memory"); \ + : "memory", "blink"); \ \ __ret; \ })