diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index b4fc760609700d122e731d0e49e3f20556a4a0a3..cad22c7b41fe4c7237acba611057255931d02fea 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -78,6 +78,8 @@ ENTRY(_main)
 	mov	x0, sp
 	bl	board_init_f_alloc_reserve
 	mov	sp, x0
+	/* set up gd here, outside any C code */
+	mov	x18, x0
 	bl	board_init_f_init_reserve
 
 	mov	x0, #0