[Bug middle-end/109707] naked attribute should imply the no_instrument_function attribute

2023-05-02 Thread i at maskray dot me via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109707

--- Comment #4 from Fangrui Song  ---
(In reply to Andrew Pinski from comment #2)
> As a workaround, you could add the attribute no_instrument_function.

Yes. I thought of this possibility, but pcc's reply on
https://github.com/llvm/llvm-project/issues/62504 makes sense to me: the only
one reasonable way is probably to skip naked functions.


The Linux kernel ran into this combination in 2009 and they switched to use
__attribute__((naked)) and __attribute__((__no_instrument_function__)) together
in https://git.kernel.org/linus/446c92b2901bedb3725d29b4e73def8aba623ffc 

> #define __naked   __attribute__((naked)) notrace
>
>
> (before hotpatch/patchable_function_entry) #define notrace 
> __attribute__((__no_instrument_function__))

[Bug middle-end/109707] naked attribute should imply the no_instrument_function attribute

2023-05-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109707

--- Comment #3 from Andrew Pinski  ---
(In reply to Andrew Pinski from comment #2)
> As a workaround, you could add the attribute no_instrument_function.

Which is documented here:
https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Common-Function-Attributes.html#index-no_005finstrument_005ffunction-function-attribute

[Bug middle-end/109707] naked attribute should imply the no_instrument_function attribute

2023-05-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109707

Andrew Pinski  changed:

   What|Removed |Added

  Component|target  |middle-end
Summary|Skip __attribute__((naked)) |naked attribute should
   |functions for -pg and   |imply the
   |-finstrument-functions  |no_instrument_function
   ||attribute

--- Comment #2 from Andrew Pinski  ---
As a workaround, you could add the attribute no_instrument_function.