This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: A MIPS --emit-relocs fix
- From: Thiemo Seufer <ths at networkno dot de>
- To: richard at codesourcery dot com
- Cc: binutils at sourceware dot org
- Date: Mon, 13 Mar 2006 21:13:08 +0000
- Subject: Re: A MIPS --emit-relocs fix
- References: <87hd62b09m.fsf@talisman.home>
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