Use CKSEG instead of KSEG, allowing it to compile on 64BIT
configurations. Also make sure that we do not truncate target
relocation address by writing it into a 32-bit wide variable.

Signed-off-by: Denis Orlov <denorl2...@gmail.com>
---
 arch/mips/lib/reloc.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c
index b084a88be7..3c845a9663 100644
--- a/arch/mips/lib/reloc.c
+++ b/arch/mips/lib/reloc.c
@@ -108,8 +108,7 @@ static void apply_reloc(unsigned int type, void *addr, long 
off)
 
 void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
 {
-       unsigned long addr, length, bss_len;
-       u32 relocaddr, new_stack;
+       unsigned long addr, length, bss_len, relocaddr, new_stack;
        uint8_t *buf;
        unsigned int type;
        long off;
@@ -121,9 +120,9 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
        length = __bss_stop - __image_start;
        relocaddr = ALIGN_DOWN(ram_size - length, SZ_64K);
        if (IS_ENABLED(CONFIG_MMU)) {
-               relocaddr = KSEG0ADDR(relocaddr);
+               relocaddr = CKSEG0ADDR(relocaddr);
        } else {
-               relocaddr = KSEG1ADDR(relocaddr);
+               relocaddr = CKSEG1ADDR(relocaddr);
        }
        new_stack = relocaddr - MALLOC_SIZE - 16;
 
-- 
2.41.0


Reply via email to