Hi Ulrich,
That was it, thanks. -mlongcall -mno-pltseq fixes the problem. 
GCC now loads the target from the module's own .toc via TOC16_HA/TOC16_LO_DS, 
which BFD resolves normally, and emits the r2 save and restore around the call itself.
I have created a new patch which adds these to the PowerPC compile options;
I've dropped the call stub patch. Tested on powerpc64le-linux,
no unexpected failures in the full testsuite.
Thanks,
Abhay


On 19/08/26 18:09, Ulrich Weigand wrote:
Abhay Kandpal <abhay@linux.ibm.com> wrote:

  24:    std     r2,24(r1)
  30:    addis   r12,r2,0
            30: R_PPC64_PLT16_HA    _setjmp
  34:    ld      r12,0(r12)
            34: R_PPC64_PLT16_LO_DS    _setjmp
80:    mtctr   r12
            80: R_PPC64_PLTSEQ    longjmp
84:    bctrl
            84: R_PPC64_PLTCALL    longjmp
  88:    ld      r2,24(r1)
I think you also need the -mno-pltseq option to get rid of
this inlined PLT sequence.

Bye,
Ulrich