From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E7CF73858D33; Fri, 3 Mar 2023 10:20:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7CF73858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677838803; bh=rWhJ9Ijm3jiE8Rl2iMHDkgfnQqZTnGgLJr5mI6OGWCI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jeQMkO16tz8RxzSOjh6/6VazUY+TgA+PQ8nzBEwRdm+Tx3oLEyI10vgX2DptHFAyW zDX/vP493vZzV3MI6Nlz+llXfGBuJAIqKM4pHnM3cULV6WH3/R4qSloCs/Zntf/md3 Qsj7jg6DuTpKFRzXQ65vBaFmSe7ygVbhk+WYjEho= From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgcc/108727] gcc.dg/split-5.c fails on power 9 BE Date: Fri, 03 Mar 2023 10:20:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgcc X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: linkw at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: linkw at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108727 Kewen Lin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amodra at gcc dot gnu.org, | |amodra at gmail dot com, | |segher at gcc dot gnu.org --- Comment #2 from Kewen Lin --- This is one bug in libgcc morestack support (powerpc64 elfv1 ABI specific): The segfault happens on: Dump of assembler code for function 00000000.plt_call._Unwind_Resume: =3D> 0x0000000010003580 <+0>: std r2,40(r1) 0x0000000010003584 <+4>: ld r12,-31760(r2) 0x0000000010003588 <+8>: mtctr r12 0x000000001000358c <+12>: ld r2,-31752(r2) 0x0000000010003590 <+16>: cmpldi r2,0 0x0000000010003594 <+20>: bnectr+ 0x0000000010003598 <+24>: b 0x100031a4 <_Unwind_Resume@plt> 0x000000001000359c <+28>: .long 0x0 The target address of std at 0x0000000010003580 is 0x7ffff72e0008, which is= n't writable as the following mappings: 0x7ffff40f0000 0x7ffff72e0000 0x31f0000 0x0 rw-p 0x7ffff72e0000 0x7ffff72f0000 0x10000 0x0 ---p For the stack segment returned from __generic_morestack, we adjust it by 32 bytes: bl JUMP_TARGET(__generic_morestack) # Start using new stack stdu %r29,-32(%r3) # back-chain mr %r1,%r3 but it isn't enough for powerpc64 elfv1 ABI as the TOC base save slot is wi= th offset 40. The fix can be to use PARAMS like: diff --git a/libgcc/config/rs6000/morestack.S b/libgcc/config/rs6000/morestack.S index 5e7ad133303..f2fea6abb10 100644 --- a/libgcc/config/rs6000/morestack.S +++ b/libgcc/config/rs6000/morestack.S @@ -205,12 +205,12 @@ ENTRY0(__morestack) bl JUMP_TARGET(__generic_morestack) # Start using new stack - stdu %r29,-32(%r3) # back-chain + stdu %r29,-PARAMS(%r3) # back-chain mr %r1,%r3 # Set __private_ss stack guard for the new stack. ld %r12,NEWSTACKSIZE_SAVE(%r29) # modified size - addi %r3,%r3,BACKOFF-32 + addi %r3,%r3,BACKOFF-PARAMS sub %r3,%r3,%r12 # Note that a signal frame has $pc pointing at the instruction # where the signal occurred. For something like a timer =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Hi Alan, does the above fix look reasonable to you?=