reticulatedpines / magiclantern_simplified

A Git based version of Magic Lantern, for those unwilling or unable to work using Mercurial. The vast majority of branches have been removed, with those thought to be important brought in individually and merged.
GNU General Public License v2.0
149 stars 51 forks source link

Correct improper uses of "naked" attribute #115

Open reticulatedpines opened 11 months ago

reticulatedpines commented 11 months ago

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 commented 11 months ago

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