[PATCH] ARM: start: Fix code reordering problem

Sascha Hauer s.hauer at pengutronix.de
Wed Jul 1 23:03:13 PDT 2015


This adds a barrier after setup_c(). This is necessary because otherwise
some global variable assignments may be reordered by the compiler to be
executed before setup_c which cannot work.
This was observed when doing other unrelated changes to the start function,
it seems in current mainline state the compiler does not actually reorder
the code.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/cpu/start.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index 304ed0c..91fd9b9 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -61,6 +61,8 @@ static noinline __noreturn void __start(unsigned long membase,
 
 	setup_c();
 
+	barrier();
+
 	pr_debug("memory at 0x%08lx, size 0x%08lx\n", membase, memsize);
 
 	barebox_boarddata = boarddata;
-- 
2.1.4




More information about the barebox mailing list