This is the mail archive of the
mailing list for the GCC project.
Re: [bfin] Don't load the address of counter variable before calling _mcount ()
- From: Jie Zhang <jzhang918 at gmail dot com>
- To: Bernd Schmidt <bernds_cb1 at t-online dot de>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 08 Nov 2006 00:33:02 +0800
- Subject: Re: [bfin] Don't load the address of counter variable before calling _mcount ()
- References: <firstname.lastname@example.org> <45509E9D.email@example.com>
Bernd Schmidt wrote:
Jie Zhang wrote:
I thought about this. In GCC internals manual, it's said that "The
To load the address of counter variable may clobber the value of P1,
which is set up in function prologue, since the instrument code is
inserted after prologue. To fix it, we could save P1 on stack before
loading the address of counter variable into P1 and pop it from stack
after _mcount return. But there is only one project using -pg on
Blackfin and it does not require the address of counter variable, so
the simpler way is not to load the address into P1 at all.
Maybe we could just define PROFILE_BEFORE_PROLOGUE?
details of how mcount expects to be called are determined by your
operating system environment, not by GCC." But there is no existing
system for Blackfin using mcount, so we have nothing we can refer to. So
I decided to follow the most common practice of other ports in GCC. Also
in GCC internals, it states that "This (no need for counter variable) is
true for almost all modern implementations." For Blackfin, adeos-tracer
is the only program using and providing mcount. And it does not need the
counter variable. Also the internals manual says that "Normally, the
profiling code comes after (function prologue)." So I chose the way as
in my patch.