This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Maintaining full frame information without -mapcs-frame on ARM
- From: Richard Earnshaw <Richard dot Earnshaw at foss dot arm dot com>
- To: Austin Lund <austin dot lund at gmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Tue, 19 May 2015 10:01:40 +0100
- Subject: Re: Maintaining full frame information without -mapcs-frame on ARM
- Authentication-results: sourceware.org; auth=none
- References: <CAHLDD1McFx0py=cdAbmhR2_Vn7xcsOH3Eo+-9HMY=pStW3xjQQ at mail dot gmail dot com>
On 28/03/15 02:04, Austin Lund wrote:
> It seems that -mapcs-frame is going away:
>
> https://gcc.gnu.org/ml/gcc-patches/2015-01/msg01001.html
>
> However, I cannot find any combination of options without -mapcs-frame
> or -mapcs which will at least maintain the full four registers (pc,
> lr, sp, fp) in the stack frame.
>
> The reason I'm wanting that is that at least for perf in linux, they
> way the kernel performs a userspace backtrace is to look up the saved
> lr register in each frame (see for example in linux
> arch/arm/kernel/perf_callchain.c). But without -mapcs-frame there is
> no guarantee that anything will be saved.
>
> What is the right switch to use in the future to ensure that the four
> registers are in each frame?
>
A bit late, but I see nobody else responded to this.
I don't expect -mapcs-frame to go away any time soon. However...
The code sequence generated with this option uses an instruction that is
deprecated in the latest versions of architecture manuals. As such,
- implementations may support this instruction with (possibly
significantly) reduced performance;
- some day in the future, the instruction concerned might be made
obsolete, in which case, code generated using it will simply cease to
work on future implementations of the CPU.
Treat this as a warning, that you should be seeking for alternative ways
to implement this functionality in your work flows. For example, a
backtrace model based on frame unwinding data would probably be much
better (and would work for back-tracing through thumb code as well).
R.