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?