[RFC PATCH 0/2] ARM: deprecation of -mapcs-frame

Jean-Philippe Brucker jean-philippe.brucker at arm.com
Mon Jan 25 09:05:19 PST 2016


In GCC 5, the -mapcs[-frame] flag for arm was deprecated [1]. Setting
this flag allowed to rely on a convenient frame format in every function,
each containing {fp, ip, lr, pc}, providing a simple way for Linux to walk
the stack.
Since that format was defined in an old version of the procedure call
standard, it is obsolete since the publication of AAPCS, in 2003.
In addition, GCC generates deprecated instructions to implement it (push
{fp, ip, lr, pc}), and there is no plan to change that.

Unfortunately, there is no drop-in replacement. Since AAPCS, the only
documented way to analyse the stack is through unwind informations,
provided by EABI.
Without -mapcs-frame, no frame format is guaranteed, and the current one
generated by GCC is subject to change. Moreover, it is different for leaf
and non-leaf functions, which would make adaptation of the APCS code
complicated.

Patch 1 moves all code relying on the APCS format behind a new option,
selectable manually. Patch 2 changes the dependency of ftrace's function
graph feature, which still relies exclusively on that frame format.

Cheers,
Jean

[1] https://gcc.gnu.org/gcc-5/changes.html#arm

Jean-Philippe Brucker (2):
  ARM: deprecate old APCS frame format
  ARM: ftrace: make function graph depend on deprecated APCS frame

 arch/arm/Kconfig                 |    2 +-
 arch/arm/Kconfig.debug           |   20 ++++++++++++++------
 arch/arm/Makefile                |    6 +++++-
 arch/arm/include/asm/ftrace.h    |    8 ++++----
 arch/arm/kernel/entry-ftrace.S   |    2 +-
 arch/arm/kernel/return_address.c |    4 ++--
 arch/arm/kernel/stacktrace.c     |   13 ++++++++++---
 arch/arm/lib/backtrace.S         |    2 +-
 arch/arm/net/bpf_jit_32.c        |    6 +++---
 9 files changed, 41 insertions(+), 22 deletions(-)

-- 
1.7.9.5




More information about the linux-arm-kernel mailing list