summaryrefslogtreecommitdiff
path: root/py/stackctrl.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott.shawcroft@gmail.com>2017-06-05 11:51:27 -0700
committerGitHub <noreply@github.com>2017-06-05 11:51:27 -0700
commit9805abd858ba45881a79870e089d082d07e60363 (patch)
tree3f2a5d4165d11c97a258b8be8f779b3797163908 /py/stackctrl.c
parent66c421f4012a47ba382f75bc1c804e8ce15469c5 (diff)
parent88b449a8cde04472970629d91b5281f0db8f0eb2 (diff)
Merge pull request #146 from dhalbert/stack_check-fix
Fix broken mp_stack_check() when using -flto
Diffstat (limited to 'py/stackctrl.c')
-rw-r--r--py/stackctrl.c4
1 files changed, 4 insertions, 0 deletions
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;
}