GCC incorrectly assumes that recursive calls are always local, and elides a nop instruction after a recursive call (which is otherwise required by the ABI).
This code generation issue affects the interposition of recursive functions and can lead to crashes if the original function is called by different means (e.g. through dlsym). The recursive call ends up calling the interposing function in a different module, but the TOC is not restored afterwards.
Details in the upstream bug report:
Originally reported against glibc:
The related test passes on both ppc64 and ppc64le with gcc-4.8.5-14.el7.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.