10000 Fix broken mp_stack_check: force mp_stack_ctrl_init() and mp_stack_us… · sparkfun/circuitpython@88b449a · GitHub
[go: up one dir, main page]

Skip to content

Commit 88b449a

Browse files
committed
Fix broken mp_stack_check: force mp_stack_ctrl_init() and mp_stack_usage() not to be inlined even with -flto
1 parent 66c421f commit 88b449a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py/stackctrl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include "py/stackctrl.h"
3232

3333
void mp_stack_ctrl_init(void) {
34+
// Force routine to not be inlined. Better guarantee than MP_NOINLINE for -flto.
35+
asm("");
3436
volatile int stack_dummy;
3537
MP_STATE_THREAD(stack_top) = (char*)&stack_dummy;
3638
}
@@ -41,6 +43,8 @@ void mp_stack_set_top(void *top) {
4143

4244
mp_uint_t mp_stack_usage(void) {
4345
// Assumes descending stack
46+
// Force routine to not be inlined. Better guarantee than MP_NOINLINE for -flto.
47+
asm("");
4448
volatile int stack_dummy;
4549
return MP_STATE_THREAD(stack_top) - (char*)&stack_dummy;
4650
}

0 commit comments

Comments
 (0)
0