http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12306
--- Comment #4 from Kazumoto Kojima <kkojima at gcc dot gnu.org> --- (In reply to Oleg Endo from comment #3) > If I understand correctly, rebuilding the GOT pointer in r12 is necessary at > function entry, since it is generally not known if r12 is a valid GOT > pointer at function entry when mixing PIC code and non-PIC code. Calling a > PIC function from a non-PIC function could result in a clobbered GOT > Yep. If a pic function is called from a pic function, that save&restore can be removed. The case like non_pic_function: mov.l r12,@-r15 sts.l pr,@-r15 <use r12 as a variable x> <call PIC function here (r12 should not be clobbered)> <use r12 as a variable x> lds.l @r15+,pr rts mov.l @r15+,r12 needs it. If we knew that that pic function can't be called from any non-pic functions by some additional information, we could optimize the code with removing that save&restore r12.