Fix profiling on powerpc32 secure-plt shared libs and PIEs
Ryan S. Arnold
ryan.arnold@gmail.com
Wed Sep 7 15:47:00 GMT 2011
On Sun, Aug 14, 2011 at 9:45 PM, Alan Modra <amodra@gmail.com> wrote:
> This patch moves the ppc32 _mcount to libc_shared.a, fixing a
> long-standing bug with profiling of secure-plt shared libraries and
> PIEs. The problem is that a ppc32 PIC PLT call stub uses r30 (GOT
> pointer) to load the function address from the PLT, r30 being set up
> in the function prologue, but _mcount is called before the function
> prologue. So chances are good that r30 will be pointing to the
> executable GOT when trying to call _mcount in a shared lib function.
> A similar problem can occur in a PIE if a shared lib calls a function
> in the executable.
>
> This change is one of the simplest out of many possible cures for the
> problem. One other simple cure, forcing bss-plt if _mcount is
> dynamic, has already been implemented in ld.
>
> 2011-08-15 Alan Modra <amodra@gmail.com>
>
> PR 13092
> * sysdeps/powerpc/Makefile (gmon): Move sysdep_routines to..
> * sysdeps/powerpc/powerpc64/Makefile (gmon): ..here..
> * sysdeps/powerpc/powerpc32/Makefile (gmon): ..and here. Add
> ppc_mcount to static-only-routines.
> * sysdeps/powerpc/powerpc32/Versions: Export GLIBC_PRIVATE
> __mcount_internal.
> * sysdeps/powerpc/powerpc32/ppc-mcount.S (_mcount): Call
> __mcount_internal with usual JUMPTARGET. Remove useless nop.
Ack!
Please consider committing this patch.
Ryan S. Arnold
More information about the Libc-alpha
mailing list