Relocations on branches
Daniel P. Volpato
danielpvolpato@gmail.com
Thu Apr 16 01:20:00 GMT 2009
Hi,
I am doing some experiments with binutils and have a doubt.
Is it possible to create PC-relative relocations for branches, so that
these can be resolved at link time?
What I mean is: instead of having this:
8: 00051880 sll v1,a1,0x2
c: 24c20000 addiu v0,a2,0
c: R_MIPS_LO16 b
...
24: 1480fff8 bnez a0,8 <workOnB+0x8>
the instruction at 0x24 would be modified and a relocation installed,
something similar to the one at 0x0c:
8: 00051880 sll v1,a1,0x2
c: 24c20000 addiu v0,a2,0
c: R_MIPS_LO16 b
...
24: 1480fff8 bnez a0,0
24: <PC_REL_RELOC> value
I did some digging on my own at this mailing list and at GCC's and, if
I get it right, this is not possible in some architectures - e.g.
MIPS, although the PC-relative relocations type exists
(BFD_RELOC_16_PCREL and others). Is that right?
Thanks,
Daniel
More information about the Binutils
mailing list