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]

Re: A MIPS --emit-relocs fix


On Mon, Mar 13, 2006 at 07:41:25PM +0000, Richard Sandiford wrote:
> The generic --emit-relocs support is geared towards targets that
> (a) use _bfd_elf_rela_local_sym and (b) set elf_backend_rela_normal to 1.
> MIPS does neither of these things.  I assume this is partly because MIPS
> needs to deal with compound relocs and partly because it needs to support
> both REL and RELA.
> 
> The upshot is that if an input file contains a relocation against a
> section symbol, the --emit-relocs version will keep the original addend.
> It won't be updated to account for the offset of the input section from
> the output section, or for the effects of merging.
> 
> We already get this right in relocatable output.  We just need to
> apply the same logic to relocations in a final link, and in addition
> handle the effects of merging (which doesn't take place for relocatable
> links).
> 
> Tested on mips64-elf, mips64-linux-gnu, mips-elf, mipsisa32-elf,
> mipsisa64-elf and mips-linux-gnu.  I also ran a full toolchain test
> on VxWorks, which uses --emit-relocs extensively.  (I'm going
> to submit the binutils support soon.)  OK to install?
> 
> Richard
> 
> 
> bfd/
> 	* elf32-mips.c (mips_elf_adjust_addend): New function, mostly split
> 	out from...
> 	(_bfd_mips_elf_relocate_section): ...here.  Use it to adjust r_addend
> 	for final links too.
> 
> ld/testsuite/
> 	* ld-mips/emit-relocs-1a.s, ld-mips/emit-relocs-1b.s,
> 	* ld-mips/emit-relocs-1.ld, ld-mips/emit-relocs-1.d: New test.
> 	* ld-mips/mips-elf.exp: Run it.

Ok.


Thiemo


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