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

Giovanni Di Sirio <gdisirio at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdisirio at gmail dot com

--- Comment #8 from Giovanni Di Sirio <gdisirio at gmail dot com> ---
I would like to support the introduction of a "root" attribute, I can bring
several examples in embedded development where this would be beneficial:

1) Thread functions in an RTOS, callee-saved registers are just stealing
precious RAM for each thread.
2) Multiple main()-like functions in multi-core MCUs, each core has its own
entry function, saving registers is again wasting space.
3) Functions called by ASM veneers, for example ISR code called by a common ASM
entry-point.

Note that "naked" and "noreturn" attributes do not help in the above scenarios
for various reasons. I experienced all the above points while developing my
ChibiOS project.

I would suggest the following behavior:
- Root functions cannot be called by C code (warning).
- The "used" attribute is implicit for "root" functions.
- Parameters and return values would work as usual, just the callee-saved
registers stacking/unstacking is skipped.
- main() would have implicitly the "root" attribute.

Reply via email to