This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Special MIPS relocation - How to?
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Francisco Rodriguez <prodrig at disca dot upv dot es>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 4 Jul 2002 16:45:57 +0930
- Subject: Re: Special MIPS relocation - How to?
- References: <000501c222c6$acfe9670$04352a9e@disca.upv.es>
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