[U-Boot] MIPS: relocate_code global offset

Kaushal Parikh kaushalparikh at gmail.com
Sun Nov 22 19:51:46 CET 2015


Hello,

MIPS relocate_code function changes the global offset register (gp)
with relocation offset.

(from arch/mips/cpu/start.S)

221         PTR_ADD gp, s1                  # adjust gp

But further in same function C function 'flush_cache' is called. This
function modifies gp, so the earlier modification to gp is undone.
Furthermore, 'in_ram' is called from 'relocate_code'. In 'in_ram',
there are references to gp

306         PTR_LA  t1, __bss_start         # t1 <-- __bss_start
307         PTR_LA  t2, __bss_end           # t2 <-- __bss_end
316         PTR_LA  t9, board_init_r

Because of gp modification by 'flush_cache', these will give older
address (before relocation).

Shouldn't these result in relocated addresses?

Thanks
Kaushal


More information about the U-Boot mailing list