This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Accessing IP on IA-64 with RTL
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: rth at redhat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 27 Jan 2005 15:24:23 -0800 (PST)
- Subject: Re: Accessing IP on IA-64 with RTL
Richard, I have a followup question about the interface to _mcount on
IA64 Linux that you sent me. Looking at the comments in _mcount.S I see
the register state that you sent but I also see a comment that this is
intended to be called before the function prologue and it is not clear
to me that there is any sensible way to call this routine after the
function prologue.
So it seems like we either need to change PROFILE_HOOK so it can be done
before the prologue or we need an interface to _mcount that can be
called after the prologue. I think that if PROFILE_HOOK is called
before the prologue then we would still have the problem described in PR
12455.
So, I would like to call mcount after the prologue but I think that if I
do that, then I don't need/want any of the stuff in _mcount but could
just call __mcount (_MCOUNT_DECL, the C routine in mcount.c) directly.
But the comments in that file make me think I should not be calling this
directly:
* mcount is called on entry to each function compiled with the profiling
* switch set. _mcount(), which is declared in a machine-dependent way
* with _MCOUNT_DECL, does the actual work and is either inlined into a
* C routine or called by an assembly stub. In any case, this magic is
* taken care of by the MCOUNT definition in <machine/profile.h>.
So I was wondering if you know why we call mcount before the prologue
instead of after and if there is any reason why we couldn't do it after
the prologue.
Also, is it is OK to call __mcount directly and bypass _mcount
completely or would we need to make some glibc changes to make a new
_mcount that was callable after the function prologue.
Steve Ellcey
sje@cup.hp.com