On Wed, Sep 30, 2020 at 05:36:08PM -0500, Segher Boessenkool wrote: > On Wed, Sep 30, 2020 at 05:06:57PM +0930, Alan Modra wrote: > > Generate assembly that is .localentry 1 with @notoc calls to match. > > What is the purpose of this? Non-obvious patchexs without any > explanation like that cost needless extra time to review :-/ > > "Support __PCREL__ code." suggests that it did not even build before? > Or did not work? Or is this just a perfomance improvement?
Sorry, I sometimes credit you with super-human powers. It's a performance improvement for libgcc.a. Calling between functions that advertise as using the TOC and those that don't, will require linker call stubs. To recap, a function that uses a TOC pointer advertises that fact by a value of 2 or larger in the symbol st_other localentry bits. A call advertises that it is from a function that needs to preserve r2 by using an R_PPC64_REL24 reloc on the call, a function that doesn't have a valid TOC pointer uses R_PPC64_REL24_NOTOC. Note that the extra stubs I'm talking about are in statically linked code. Calls to shared library functions have no extra overhead due to mis-matched toc/notoc code. Those calls need a plt call stub anyway. Also, indirect calls are not affected. > > gcc/ > > * config/rs6000/ppc-asm.h: Support __PCREL__ code. > > libgcc/ > > * config/rs6000/morestack.S, > > * config/rs6000/tramp.S, > > * config/powerpc/sjlj.S: Support __PCREL__ code. > > The patch does look fine. Okay for trunk (and backports if those are > wanted; discuss with Bill I guess). Thanks! > > (But please explain the purpose of this, in the commit message if that > makes sense.) > > > Segher -- Alan Modra Australia Development Lab, IBM