[PATCH] Add -fno-instrument-function

Richard Biener richard.guenther@gmail.com
Thu Sep 4 13:11:00 GMT 2014


On Thu, Sep 4, 2014 at 8:04 AM, Andi Kleen <andi@firstfloor.org> wrote:
>> No, not a new "fake" option either but just initialize
>> DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT properly when
>> not doing -pg or -mfentry (that is, set it to 1).
>
> The only way would be to handle it in build_decl itself.
> There seem to be a bazillion callers all over the tree that all do their
> custom thing.
>
> It would also need a new target hook to check for fentry.
>
> Far more complicated patch.

Well, then make it the opposite as I suggested - mark functions
to be instrumented - DECL_INSTRUMENT_FUNCTION_ENTRY_EXIT
and do that in the instrumentation code or the target hook that
gets called when a struct function is initialized.

Or as all this is only a hack for LTO, "set"
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT in
tree-streamer-out.c:pack_ts_function_decl_value_fields.

Yes, you need a target hook for -mfentry, but that's way better
than a user-visible option for such kind of "hack".

Richard.

> -Andi
>
>
> --
> ak@linux.intel.com -- Speaking for myself only.



More information about the Gcc-patches mailing list