On Wed, Oct 6, 2010 at 12:13 AM, Richard Henderson <r...@redhat.com> wrote: > On 10/05/2010 02:40 PM, Joakim Tjernlund wrote: >> Especially one that doesn't require each function >> to calculate the GOT address in the function prologue(why is that so?) > > Because PIC code can be called from non-PIC code and because > the non-PIC code does not load the GOT address. > > Avoiding re-computation of the PIC register is something that > could be done via LTO and/or cgraph optimizations. To my > knowledge, no one is working on that at present.
It should be a matter of calling cgraph_only_called_directly_p () on the own cgraph node when expanding the GOT address calculation. Assuming that it is preserved across all call-sites we'd retain GOT address computation only in functions that can be called in ways the compiler doesn't know. Richard. > > r~ >