From 28dbcedc7b1282b93c3f25c4e42ae71b44e8e2a8 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 9 Dec 2014 14:32:22 +1030 Subject: Don't sort ld -r relocs for mips HI16/LO16 are deliberately put adjacent, which might mean relocs are then not sorted by r_offset. See tc-mips.c:mips_frob_file. Don't undo the HI16/LO16 sorting. PR 17666 * elf-bfd.h (struct elf_backend_data): Add sort_relocs_p. * elfxx-target.h (elf_backend_sort_relocs_p): Define. (elfNN_bed): Init new field. * elflink.c (elf_link_adjust_relocs): Conditionally sort. (bfd_elf_final_link): Control sorting of relocs. * elfxx-mips.c (_bfd_mips_elf_sort_relocs_p): New function. * elfxx-mips.h (_bfd_mips_elf_sort_relocs_p): Declare. * elf32-mips.c (elf_backend_sort_relocs_p): Define. * elf64-mips.c (elf_backend_sort_relocs_p): Define. --- bfd/elf-bfd.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bfd/elf-bfd.h') diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 3e54ab1..514fdcd 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1109,6 +1109,11 @@ struct elf_backend_data unsigned int (*elf_backend_count_relocs) (struct bfd_link_info *, asection *); + /* Say whether to sort relocs output by ld -r and ld --emit-relocs, + by r_offset. If NULL, default to true. */ + bfd_boolean (*sort_relocs_p) + (asection *); + /* This function, if defined, is called when an NT_PRSTATUS note is found in a core file. */ bfd_boolean (*elf_backend_grok_prstatus) -- cgit v1.1