From 88b449a8cde04472970629d91b5281f0db8f0eb2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 4 Jun 2017 22:05:55 -0400 Subject: Fix broken mp_stack_check: force mp_stack_ctrl_init() and mp_stack_usage() not to be inlined even with -flto --- py/stackctrl.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'py/stackctrl.c') diff --git a/py/stackctrl.c b/py/stackctrl.c index 83d1faeb9..1c46a9434 100644 --- a/py/stackctrl.c +++ b/py/stackctrl.c @@ -31,6 +31,8 @@ #include "py/stackctrl.h" void mp_stack_ctrl_init(void) { + // Force routine to not be inlined. Better guarantee than MP_NOINLINE for -flto. + asm(""); volatile int stack_dummy; MP_STATE_THREAD(stack_top) = (char*)&stack_dummy; } @@ -41,6 +43,8 @@ void mp_stack_set_top(void *top) { mp_uint_t mp_stack_usage(void) { // Assumes descending stack + // Force routine to not be inlined. Better guarantee than MP_NOINLINE for -flto. + asm(""); volatile int stack_dummy; return MP_STATE_THREAD(stack_top) - (char*)&stack_dummy; } -- cgit v1.2.3