This is the mail archive of the
mailing list for the glibc project.
Re: new ppc32 GOT/PLT support
- From: Steve Munroe <sjmunroe at us dot ibm dot com>
- To: Alan Modra <amodra at bigpond dot net dot au>
- Cc: libc-alpha at sources dot redhat dot com, Jakub Jelinek <jakub at redhat dot com>, Olaf Hering <olh at suse dot de>
- Date: Tue, 7 Jun 2005 17:26:32 -0500
- Subject: Re: new ppc32 GOT/PLT support
Alan Modra <firstname.lastname@example.org> 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, 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), setup
up the frompc and seflpc parameters in r3/r4, before calling
Also gcc is still generating the -pg prologue as:
0: .long 0
The .data word and its address in r0 are neaver used (by mcount.c or any
other code that I can find). Also this is a non-PIC sequence that we
should elliminate for the new ABI.
One posibililty is to move the ppc-mcount.S stub code into libc_nonshared
and have it establish the got (using the new ABI). Then we could call
gmon/mcount.c version of _mcount via the new PLT. So we need two prologues
for the profiling case. One for the leaf routine case where the mcount
stub establishes its own got. And one for the none leave case where the bl
_local_mcount established the lr for the got sequence.
So the leaf case looks like:
# we can assume that on return r0/lr are restored by _leaf_mcount
# to the entry value.
And the non-leaf case could look like:
# we can assume that on return r0 are restored by _local_mcount
# to the lr on entry.
stw r0,36(r1) # this is probably redundent
This will require versioning the _mcount symbol for the new ABI.
Steven J. Munroe
Linux on Power Toolchain Architect
IBM Corporation, Linux Technology Center