Special MIPS relocation - How to?
Alan Modra
amodra@bigpond.net.au
Thu Jul 4 00:21:00 GMT 2002
On Wed, Jul 03, 2002 at 09:20:21PM +0200, Francisco Rodriguez wrote:
> My problem now is, that these relocs should be resolved at link time,
> but only when all other relocs have been processed. This is because
> these relocs are based on the final ".text" section contents, not on
> symbol addresses.
>
> And I simply don't know how to do it.
> I've only reached to tweak the bfd library so ld silently ignore my relocs
> (in bfd_mips_elf_relocate_section).
>
> Could anyone offer a hint about how to do it?
A general solution might be:
o Create a fake input bfd. (Example of fake input bfds can be found
in ppc64elf.em and hppaelf.em.) Further, give the fake bfd an
input section (zero size ok) with a reloc.
o In ldemul_after_open, reorder the input bfd list so that the fake
is last.
o In bfd_mips_elf_relocate_section, when processing normal input
bfds, save information about your new relocs somewhere. When
processing the fake bfd, read the output .text section back from
disk, and use it and the saved info to produce whatever you
desire.
This will be quite a lot of work.
You might be able to do something simpler, but you haven't told us
much about your new relocs.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list