This is the mail archive of the
mailing list for the binutils project.
Re: PATCH: Remove _bfd_elf_reloc_type_class
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "H . J . Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 24 Apr 2002 09:25:38 +0200
- Subject: Re: PATCH: Remove _bfd_elf_reloc_type_class
- References: <20020423204242.A13213@lucon.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Apr 23, 2002 at 08:42:42PM -0700, H . J . Lu wrote:
> The reason why MIPS works is elf_link_sort_relocs doesn't do anything
> since _bfd_elf_reloc_type_class just returns reloc_class_normal. Is
> there any reason to call elf_link_sort_relocs if the default
> elf_backend_reloc_type_class is used?
Sure there is. The most important about the sorting is that it
puts relocations against the same symbol together.
reloc_type_class is used only to sort different relocs against the
same symbol (and to put RELATIVE relocs separately).
So, the order of sorting keys is:
1) RELATIVE relocs come first (sorted with ascending r_offset
2) relocs are sorted by moreless ascending r_offset
3) if two relocs are against the same symbol, their are groupped
together after reloc with lowest r_offset reloc against that symbol
4) inside of each R_SYM group COPY relocs are put together
5) if reloc class and R_SYM are the same, sorted by ascending r_offset
So your patch looks wrong, because you no longer sort at all.
This may work just fine for mips which sorts it on its own once again
(dunno if before or after), but certainly doesn't work for any other backend.
> 2002-04-23 H.J. Lu (firstname.lastname@example.org)
> * elf-bfd.h (_bfd_elf_reloc_type_class): Removed.
> * elf.c (_bfd_elf_reloc_type_class): Likewise.
> * elflink.h (elf_bfd_final_link): Call elf_link_sort_relocs
> only if bed->elf_backend_reloc_type_class != NULL.
> * elfxx-target.h (elf_backend_reloc_type_class): Default to