https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79439
--- Comment #2 from Florian Weimer <fw at gcc dot gnu.org> --- (In reply to Segher Boessenkool from comment #1) > What command line options does this need? Sorry, I used -O2 -fpic. Indeed, GCC seems to perform target-independent optimizations based on an assumption that the recursive call calls the same function as defined in the translation unit. If this is the desired behavior, the proper fix would be to use a local reference for the recursive call. This would make those optimizations consistent, and interposition would work to some extent. Of course, the recursive calls wouldn't be interposed anymore, but the TOC corruption would at least be gone.