Since GCC 4.6 we aggressively prune bodies of GNU extern inline functions which means that instrumenting them via -finstrument-functions doesn't work because that takes the address of the function. Fixed by not instrumenting those functions (we still instrument regular always-inline functions and that works as expected).
In the PR this affects intrinsic header functions but it will also affect fortify wrappers and in both cases instrumenting is undesirable I think. Bootstrap / regtest in progress on x86_64-unknown-linux-gnu. Richard. 2016-11-16 Richard Biener <rguent...@suse.de> PR middle-end/78333 * gimplify.c (gimplify_function_tree): Do not instrument GNU extern inline functions. * gcc.dg/pr78333.c: New testcase. Index: gcc/gimplify.c =================================================================== --- gcc/gimplify.c (revision 242408) +++ gcc/gimplify.c (working copy) @@ -12547,6 +12559,10 @@ gimplify_function_tree (tree fndecl) /* ??? Add some way to ignore exceptions for this TFE. */ if (flag_instrument_function_entry_exit && !DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl) + /* Do not instrument extern inline functions. */ + && !(DECL_DECLARED_INLINE_P (fndecl) + && DECL_EXTERNAL (fndecl) + && DECL_DISREGARD_INLINE_LIMITS (fndecl)) && !flag_instrument_functions_exclude_p (fndecl)) { tree x; Index: gcc/testsuite/gcc.dg/pr78333.c =================================================================== --- gcc/testsuite/gcc.dg/pr78333.c (revision 0) +++ gcc/testsuite/gcc.dg/pr78333.c (working copy) @@ -0,0 +1,9 @@ +/* { dg-do link } */ +/* { dg-options "-finstrument-functions" } */ + +extern inline __attribute__((gnu_inline, always_inline)) int foo () { } +int main() +{ + foo (); + return 0; +}