This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix profiling on powerpc32 secure-plt shared libs and PIEs
- From: "Ryan S. Arnold" <ryan dot arnold at gmail dot com>
- To: libc-alpha at sourceware dot org
- Cc: Alan Modra <amodra at gmail dot com>
- Date: Wed, 7 Sep 2011 10:42:17 -0500
- Subject: Re: Fix profiling on powerpc32 secure-plt shared libs and PIEs
- References: <20110815024551.GA4417@bubble.grove.modra.org>
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