This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Relocations on branches


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]