ARM/v7-a: Force -O2 compilation of idle thread

This fixes a problem with -O0 SMP builds on ARM visible as kernel
data aborts whenever the idle thread executes.

The idle thread receives no stack pointer. At -O2, this is fine
as the wfi() call is inlined and stack operations in idle_thread
are optimized out. At -O0, the stack operations remain and wfi()
is not inlined, resulting in stack accesses in the idle thread
that cause data aborts.

Forcing -O2 behaviour was deemed the simplest solution for now.
Giving the idle thread a stack would have had larger verification
ramifications for what is now a fairly uncommon use case.
This commit is contained in:
Sebastian Holzapfel
2018-03-06 12:49:09 +11:00
parent 94f22865f3
commit 60aac65c99
3 changed files with 14 additions and 2 deletions

View File

@@ -43,6 +43,7 @@
#define UNUSED __attribute__((unused))
#define USED __attribute__((used))
#define FASTCALL __attribute__((fastcall))
#define FORCE_O2 __attribute__((optimize("O2")))
/** MODIFIES: */
void __builtin_unreachable(void);
#define UNREACHABLE() __builtin_unreachable()