What is to be updated in reginfo section coprocessor register mask?

Ian Lance Taylor ian@wasabisystems.com
Sun Apr 25 00:29:00 GMT 2004


"K. Ahmed Feroz" <feroz@acmet.com> writes:

> However, the coprocessor register mask and the value for the offset of
> GP register are always initialized to 0(zero).
> 
> 
> Is this the correct behaviour?

Certainly the assembler should not always emit a .reginfo section
which has zero for the coprocessor register masks and the GP offset.
However, there are of course also cases where zero values are
correct.

> Secondly, if there is some relocation with respect to GP register,
> should the offset of GP to be subtracted from the addend at which
> relocation is to be done?
> 
> For example,
> .lcomm	l_var2.3,8
> sw	$2,l_var2.3
> 
> The opcode for the above instruction is   af82c008
> 
> and relocation record is (.sbss ,R_MIPS_GPREL16)
> 
> Here we see that the 16 bit immediate value is 0xc008
> 
> Which is formed by subtracting 0x0008-0x4000 = 0xc008
> 
> If the PC location value of the l_var2.3 is 0x0008
> 
> GP Value is 0x4000

This all looks fine to me.  When the linker computes the final value,
it will add in the object file GP value (i.e., 0x4000) and then
subtract the GP value for the fully linked executable.

Ian



More information about the Binutils mailing list