Maintaining full frame information without -mapcs-frame on ARM
Tue May 19 09:01:00 GMT 2015
On 28/03/15 02:04, Austin Lund wrote:
> It seems that -mapcs-frame is going away:
> 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).
More information about the Gcc-help