aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2018-11-29 23:11:47 +0000
committerAndi Kleen <ak@gcc.gnu.org>2018-11-29 23:11:47 +0000
commit3b31afe1a56cfb7b92f563b53686b378bdbead54 (patch)
tree4a9b821db915c6d93e7d73e2d80b79bb5637517e /gcc/c
parent856f4c6a9cfac1471c323b1783130879e2bbc15f (diff)
downloadgcc-3b31afe1a56cfb7b92f563b53686b378bdbead54.zip
gcc-3b31afe1a56cfb7b92f563b53686b378bdbead54.tar.gz
gcc-3b31afe1a56cfb7b92f563b53686b378bdbead54.tar.bz2
Support instrumenting returns of instrumented functions
When instrumenting programs using __fentry__ it is often useful to instrument the function return too. Traditionally this has been done by patching the return address on the stack frame on entry. However this is fairly complicated (trace function has to emulate a stack) and also slow because it causes a branch misprediction on every return. Add an option to generate call or nop instrumentation for every return instead, including patch sections. This will increase the program size slightly, but can be a lot faster and simpler. This version only instruments true returns, not sibling calls or tail recursion. This matches the semantics of the original stack. gcc/: 2018-11-29 Andi Kleen <ak@linux.intel.com> * config/i386/i386-opts.h (enum instrument_return): Add. * config/i386/i386.c (output_return_instrumentation): Add. (ix86_output_function_return): Call output_return_instrumentation. (ix86_output_call_insn): Call output_return_instrumentation. * config/i386/i386.opt: Add -minstrument-return=. * doc/invoke.texi (-minstrument-return): Document. gcc/testsuite/: 2018-11-29 Andi Kleen <ak@linux.intel.com> * gcc.target/i386/returninst1.c: New test. * gcc.target/i386/returninst2.c: New test. * gcc.target/i386/returninst3.c: New test. From-SVN: r266652
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions