MIPS: fix a latent bug on initialize $gp
authorZhi-zhou Zhang <zhizhou.zh@gmail.com>
Sat, 24 Nov 2012 05:07:12 +0000 (05:07 +0000)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Sat, 8 Dec 2012 20:33:07 +0000 (21:33 +0100)
If bal is 8 bytes aligned, the _gp will not be 8 bytes aligned.
then the following ld insntrustion generates a Adel exception.
So here make _gp be always aligned in 8 bytes.

Signed-off-by: Zhi-zhou Zhang <zhizhou.zh@gmail.com>
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
arch/mips/cpu/mips64/start.S

index 4112de7026a51f8c854a14414f9d9f920b7ef28f..2b8d531e73b84ef9d2e0280165ed1668dad9d318 100644 (file)
@@ -108,7 +108,12 @@ reset:
        mtc0    t0, CP0_CONFIG
 #endif
 
-       /* Initialize $gp */
+       /*
+        * Initialize $gp, force 8 byte alignment of bal instruction to forbid
+        * the compiler to put nop's between bal and _gp. This is required to
+        * keep _gp and ra aligned to 8 byte.
+        */
+       .align  3
        bal     1f
         nop
        .dword  _gp