diff options
author | Zhi-zhou Zhang <zhizhou.zh@gmail.com> | 2012-11-24 05:07:12 +0000 |
---|---|---|
committer | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2012-12-08 21:33:07 +0100 |
commit | 0d69d918abff1437c78610dac8b18e8f91917674 (patch) | |
tree | 24a6ae635e0cb483a2de93e25bb9729224fcf975 | |
parent | fd4d564b3c80b111f18c93adb14233a6a7ddb0e9 (diff) |
MIPS: fix a latent bug on initialize $gp
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>
-rw-r--r-- | arch/mips/cpu/mips64/start.S | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/mips/cpu/mips64/start.S b/arch/mips/cpu/mips64/start.S index 4112de7026..2b8d531e73 100644 --- a/arch/mips/cpu/mips64/start.S +++ b/arch/mips/cpu/mips64/start.S @@ -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 |