Support changing fentry name per function

Programming / Compilers / GCC - ak [138bc75d-0d04-0410-961f-82ee72b054a4] - 29 November 2018 23:11 EST

It can be useful to have some classes of functions that use a different __fentry__ instrumentation than others. Currently it is only possible to disable instrumentation on the command line or with no_instrument_function, but not to change the instrumentation function on a case by case base.

Add some flexibility to allow to change the instrumentation function name per file with an option or per function with a new attribute. This also allows switching to nops for individual functions.

gcc/:

2018-11-29 Andi Kleen

- config/i386/i386.c (x86_print_call_or_nop): Handle nop name. (current_fentry_name): Add. (x86_function_profiler): Handle fentry_name attribute. (ix86_handle_fentry_name): Add. (ix86_attribute_table): Add fentry_name.
- config/i386/i386.opt: Add -mfentry-name
- doc/extend.texi: Document fentry_name.
- doc/invoke.texi: Document minstrument-return.

gcc/testsuite/:

2018-11-29 Andi Kleen

- gcc.target/i386/fentryname1.c: New test.

d4b85bdc318 Support changing fentry name per function
gcc/ChangeLog | 11 +++++++
gcc/config/i386/i386.c | 48 ++++++++++++++++++++++++++---
gcc/config/i386/i386.opt | 4 +++
gcc/doc/extend.texi | 7 +++++
gcc/doc/invoke.texi | 6 +++-
gcc/testsuite/ChangeLog | 4 +++
gcc/testsuite/gcc.target/i386/fentryname1.c | 15 +++++++++
7 files changed, 89 insertions(+), 6 deletions(-)

Upstream: gcc.gnu.org


  • Share