new ppc32 GOT/PLT support for mcount
Steve Munroe
sjmunroe@us.ibm.com
Thu Jun 9 22:30:00 GMT 2005
Alan Modra <amodra@bigpond.net.au> wrote on 05/17/2005 09:33:53 AM:
> ...One problem remains: ppc32 calls
> _mcount before the function prologue, so it's not possible to set up
> registers to call _mcount via the plt in pic code. So for now, if you
> profile pic code using a dynamic _mcount, the call sequence used will
> force the old exec GOT/PLT. I'm thinking the best thing is to make
> _mcount available in libc_nonshared, and only keep _mcount in libc.so
> to satisfy explicit versions, but I'm open to suggestions.
>
Looking at the details, in the current powerpc32 implementation
gmon/mcount.c is aliased to __mcount_internal and the exported _mcount
symbol is defined by the stub in ppc-mcount.S. ppc-mount.S; stacks a
frame, saves the parameter register (r3-r10), does setup up the frompc
and seflpc parameters in r3/r4, before calling __mcount_internal.
Also gcc is still generating the -pg prologue as:
.data
.align 2
0: .long 0
.previous
func:
mflr r0
lis r11,0b@ha
stw r0,4(r1)
addi r0,r11,0b@l
bl _mcount
The .data word and its address in r0 are never used (by mcount.c or any
other code that I can find). Also this is a non-PIC sequence that we
should eliminate for the new ABI. The new -pg prologue would be:
func:
mflr r0
stw r0,4(r1)
bl _mcount@local
# we can assume that on return r0/lr are restored by _mcount
# to the entry value.
...
One possibility is to move a version of the ppc-mcount.S stub code into
libc_nonshared and have it establish the got (using the new ABI) before
calling __mcount_internal via the new PLT.
For compatibility we need to version _mcount. The old version in
ppc-mcount.S will be export _mcount@GLIBC_2.0. The new version
(ppc2-mcount.S) will export the default version _mcount@@GLIBC_2.4. The
new version will included in libc_nonshared.a so it can be called @local
from -pg prologues. The implementation of __mcount_internal
(gmon/mcount.c) will remain unchanged except for
making__mcount_internal@@GLIBC_PRIVATE.
The attached patch implements the glibc par this proposal. The gcc
portion should mostly clean up.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ppc32-mcount2-20050609.txt
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20050609/35fd51fa/attachment.txt>
More information about the Libc-alpha
mailing list