https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77882

--- Comment #8 from Elad Lahav <e2lahav at gmail dot com> ---
(In reply to Andrew Pinski from comment #7)
> The problem with the naked attribute is usually it is not well defined.  For
> things like interrupts functions and interrupt returns, there is always
> plain .s files. Interrupts usually save/restore all registers including the
> floating point ones.  So they are large.  The float point ones can get
> complex now with SVE too.

I am actually using this facility to write kernel entry and exit routines. As I
said, the advantage over pure assembly files is that you can use offsetof() and
_Static_assert() when storing and loading registers to and from kernel data
structures. You can also break up large chunks (such as storing and loading FPU
registers) into inline functions.

So far it looks like the compiler is doing the right thing with a combination
of naked functions and inline functions: the code I get is exactly the inline
assembly in these functions without any modifications or additions. If that is
not guaranteed then it is indeed a problem.

Reply via email to