magiclantern_simplified icon indicating copy to clipboard operation
magiclantern_simplified copied to clipboard

Correct improper uses of "naked" attribute

Open reticulatedpines opened this issue 1 year ago • 1 comments

We use "naked" on some functions, e.g. backtrace_getstr() (here, presumably to avoid disturbing register contents before doing the backtrace), but, GCC states: "While using extended asm or a mixture of basic asm and C code may appear to work, they cannot be depended upon to work reliably and are not supported" https://gcc.gnu.org/onlinedocs/gcc/ARM-Function-Attributes.html

We use both extended asm and C in functions marked naked, which is not supported.

I couldn't find a way to get GCC to warn about this behaviour, so reliably detecting it may be impossible. We don't use it very often so at a minimum we should audit and fix all naked functions.

reticulatedpines avatar Oct 12 '23 13:10 reticulatedpines

We do this in copy_and_restart()! That will want fixing.

reticulatedpines avatar Oct 12 '23 13:10 reticulatedpines