* [Bug testsuite/108727] gcc.dg/split-5.c fails on power 9 BE
2023-02-08 20:45 [Bug testsuite/108727] New: gcc.dg/split-5.c fails on power 9 BE seurer at gcc dot gnu.org
@ 2023-03-01 6:03 ` linkw at gcc dot gnu.org
2023-03-03 10:20 ` [Bug libgcc/108727] " linkw at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-03-01 6:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108727
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |linkw at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2023-03-01
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |linkw at gcc dot gnu.org
--- Comment #1 from Kewen Lin <linkw at gcc dot gnu.org> ---
Confirmed, probably expose one bug in libgcc related support, I'll have a look
first.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libgcc/108727] gcc.dg/split-5.c fails on power 9 BE
2023-02-08 20:45 [Bug testsuite/108727] New: gcc.dg/split-5.c fails on power 9 BE seurer at gcc dot gnu.org
2023-03-01 6:03 ` [Bug testsuite/108727] " linkw at gcc dot gnu.org
@ 2023-03-03 10:20 ` linkw at gcc dot gnu.org
2023-03-03 12:58 ` amodra at gmail dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-03-03 10:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108727
Kewen Lin <linkw at gcc dot gnu.org> 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 <linkw at gcc dot gnu.org> ---
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:
=> 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 isn'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 with
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
============================================================
Hi Alan, does the above fix look reasonable to you?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libgcc/108727] gcc.dg/split-5.c fails on power 9 BE
2023-02-08 20:45 [Bug testsuite/108727] New: gcc.dg/split-5.c fails on power 9 BE seurer at gcc dot gnu.org
2023-03-01 6:03 ` [Bug testsuite/108727] " linkw at gcc dot gnu.org
2023-03-03 10:20 ` [Bug libgcc/108727] " linkw at gcc dot gnu.org
@ 2023-03-03 12:58 ` amodra at gmail dot com
2023-03-06 11:01 ` linkw at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: amodra at gmail dot com @ 2023-03-03 12:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108727
--- Comment #3 from Alan Modra <amodra at gmail dot com> ---
Yes, looks good to me.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libgcc/108727] gcc.dg/split-5.c fails on power 9 BE
2023-02-08 20:45 [Bug testsuite/108727] New: gcc.dg/split-5.c fails on power 9 BE seurer at gcc dot gnu.org
` (2 preceding siblings ...)
2023-03-03 12:58 ` amodra at gmail dot com
@ 2023-03-06 11:01 ` linkw at gcc dot gnu.org
2023-03-08 7:00 ` cvs-commit at gcc dot gnu.org
2023-03-08 8:11 ` linkw at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-03-06 11:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108727
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2023-March/6
| |13441.html
--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Alan Modra from comment #3)
> Yes, looks good to me.
Thanks Alan! An formal patch was posted as URL field.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libgcc/108727] gcc.dg/split-5.c fails on power 9 BE
2023-02-08 20:45 [Bug testsuite/108727] New: gcc.dg/split-5.c fails on power 9 BE seurer at gcc dot gnu.org
` (3 preceding siblings ...)
2023-03-06 11:01 ` linkw at gcc dot gnu.org
@ 2023-03-08 7:00 ` cvs-commit at gcc dot gnu.org
2023-03-08 8:11 ` linkw at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-08 7:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108727
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:
https://gcc.gnu.org/g:15b83b69ca99d97643075776ba94f2dd1f05b46e
commit r13-6545-g15b83b69ca99d97643075776ba94f2dd1f05b46e
Author: Kewen Lin <linkw@linux.ibm.com>
Date: Wed Mar 8 00:57:21 2023 -0600
libgcc, rs6000: Fix bump size for powerpc64 elfv1 ABI [PR108727]
As PR108727 shows, when cleanup code called by the stack
unwinder calls function _Unwind_Resume, it goes via plt
stub like:
function 00000000.plt_call._Unwind_Resume:
=> 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>
It wants to save TOC base (r2) to r1 + 40, but we only
bump the stack segment by 32 bytes as follows:
stdu %r29,-32(%r3)
It means the access is out of the stack segment allocated
by __generic_morestack, once the touch area isn't writable
like this failure shows, it would cause segment fault.
So fix the bump size with one reasonable value PARAMS.
PR libgcc/108727
libgcc/ChangeLog:
* config/rs6000/morestack.S (__morestack): Use PARAMS for new stack
bump size.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libgcc/108727] gcc.dg/split-5.c fails on power 9 BE
2023-02-08 20:45 [Bug testsuite/108727] New: gcc.dg/split-5.c fails on power 9 BE seurer at gcc dot gnu.org
` (4 preceding siblings ...)
2023-03-08 7:00 ` cvs-commit at gcc dot gnu.org
@ 2023-03-08 8:11 ` linkw at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-03-08 8:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108727
Kewen Lin <linkw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Kewen Lin <linkw at gcc dot gnu.org> ---
Should be fixed on trunk.
^ permalink raw reply [flat|nested] 7+ messages in thread