3 ms·
You can't generally change the direction the stack moves, at least on targets like Cortex-M. Maybe in ASM it'd be feasible to work around, but getting LLVM to d
by jamesmunns 3y ago
You can't generally change the direction the stack moves, at least on targets like Cortex-M. Maybe in ASM it'd be feasible to work around, but getting LLVM to do this isn't anything I've ever seen.
The "walk off the edge" technique is what is described here [0], in embedded rust we have a tool that does this automatically (from the author of the post) called `flip-link` [1]. It requires a second linker/re-linking pass to do this sizing automatically (you could also do the same manually with a linker script in one pass, if you hardcode certain sizes).
[0]: https://blog.japaric.io/stack-overflow-protection/ https://blog.japaric.io/stack-overflow-protection/
[1]: https://github.com/knurling-rs/flip-link https://github.com/knurling-rs/flip-link