Re: tracing: gcc for x86 calling mcount with -fomit-frame-pointer

From: Andi Kleen
Date: Thu Dec 17 2009 - 14:02:30 EST


John Reiser <jreiser@xxxxxxxxxxxx> writes:

> On x86 and x86_64, current "gcc -pg -fomit-frame-pointer" is not allowed.
> This experimental patch against:
> http://mirrors.kernel.org/fedora/releases/12/Fedora/source/SRPMS/gcc-4.4.2-7.fc12.src.rpm
> allows such a combination, via the command line options:
> gcc --profile-before-prolog -fomit-frame-pointer
> This turns on profiling (as if -pg), moves the "call mcount" to be the
> very first instruction of a profiled routine, and omits the frame pointer
> (unless some condition other than profiling requires a frame pointer.)
> Placing the "call mcount" first, before any other code, has some advantages.
> For instance, a postprocessor easily can modify a CALL whose destination
> is known, to skip past the "call mcount" at the entry point.
>
> The current glibc implementation of mcount relies on a frame pointer.
> At least one recent change to Linux kernel traceback for tracing also relies
> on a frame pointer. So still there are conflicts, but they are different.

I submitted a similar patch for all of this some time to gcc,
and also resubmitted it recently. It doesn't seem to be very high
up the priority list of the gcc people.

It missed their "merge window" (although lots of other changes went in),
but they told me it's queued in some way for the next stage 1.
We'll see if that's true or not.

I also have a glibc patch for this.

-Andi


--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/