From patchwork Tue Aug 15 11:50:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 22119 Received: (qmail 70967 invoked by alias); 15 Aug 2017 11:53:39 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 46747 invoked by uid 89); 15 Aug 2017 11:52:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, URIBL_RED autolearn=ham version=3.3.2 spammy=conform X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Aurelien Jarno Subject: [PATCH] mips/o32: fix internal_syscall5/6/7 Date: Tue, 15 Aug 2017 13:50:55 +0200 Message-Id: <20170815115055.29375-1-aurelien@aurel32.net> The internal_syscall5/6/7 functions use the stack pointer to store the 5th and following arguments on the stack. In some cases GCC optimize out the stack pointer, and thus storing the data to the stack causes a segmentation fault. Fix that by declaring the sp register as clobbered. Not sure it is the best way to do that, but it seems to be enough to force GCC to not optimize it out. This fixes the nptl/tst-rwlock15 test on mips/o32. ChangeLog: * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (internal_syscall5): Add "$29" to the clobber list. (internal_syscall6): Likewise. (internal_syscall7): Likewise. --- ChangeLog | 7 +++++++ sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56540f55a1..5d1a088431 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-08-15 Aurelien Jarno + + * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h + (internal_syscall5): Add "$29" to the clobber list. + (internal_syscall6): Likewise. + (internal_syscall7): Likewise. + 2017-08-14 Joseph Myers * conform/data/sys/wait.h-data (si_value): Do not expect for diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index e9e3ee7e82..0df32c186f 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -294,7 +294,7 @@ : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2), \ "r" ((long) (arg5)) \ - : __SYSCALL_CLOBBERS); \ + : __SYSCALL_CLOBBERS, "$29"); \ err = __a3; \ _sys_result = __v0; \ } \ @@ -327,7 +327,7 @@ : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2), \ "r" ((long) (arg5)), "r" ((long) (arg6)) \ - : __SYSCALL_CLOBBERS); \ + : __SYSCALL_CLOBBERS, "$29"); \ err = __a3; \ _sys_result = __v0; \ } \ @@ -361,7 +361,7 @@ : "=r" (__v0), "+r" (__a3) \ : input, "r" (__a0), "r" (__a1), "r" (__a2), \ "r" ((long) (arg5)), "r" ((long) (arg6)), "r" ((long) (arg7)) \ - : __SYSCALL_CLOBBERS); \ + : __SYSCALL_CLOBBERS, "$29"); \ err = __a3; \ _sys_result = __v0; \ } \