]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Don't sort ld -r output relocs on alpha
authorAlan Modra <amodra@gmail.com>
Thu, 27 Aug 2015 01:24:28 +0000 (10:54 +0930)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 24 Aug 2017 12:47:21 +0000 (09:47 -0300)
LITERAL/LITUSE relocs must be kept together.

PR 18867
* elf64-alpha.c (elf64_alpha_sort_relocs_p): New function.
(elf_backend_sort_relocs_p): Define.

bfd/ChangeLog
bfd/elf64-alpha.c

index 103e2c3080059eade5f3055c4e6f664c69143efe..9cc93a9d8658e8fcbe1a484f5f10a5290797a6fa 100644 (file)
@@ -1,6 +1,11 @@
 2015-08-27  Alan Modra  <amodra@gmail.com>
 
        Apply from master
+       2015-08-27  Alan Modra  <amodra@gmail.com>
+       PR 18867
+       * elf64-alpha.c (elf64_alpha_sort_relocs_p): New function.
+       (elf_backend_sort_relocs_p): Define.
+
        2015-08-26  Alan Modra  <amodra@gmail.com>
        PR 18867
        * elflink.c (cmp_ext32l_r_offset, cmp_ext32b_r_offset): Delete.
index 8f8cf7bc0214fe53e76291683b371b6b4f1f8eda..094a0b9524278a4d9e7c2047adeabb4cd8492b21 100644 (file)
@@ -1757,6 +1757,18 @@ elf64_alpha_want_plt (struct alpha_elf_link_hash_entry *ah)
          && (ah->flags & ~ALPHA_ELF_LINK_HASH_LU_PLT) == 0);
 }
 
+/* Whether to sort relocs output by ld -r or ld --emit-relocs, by r_offset.
+   Don't do so for code sections.  We want to keep ordering of LITERAL/LITUSE
+   as is.  On the other hand, elf-eh-frame.c processing requires .eh_frame
+   relocs to be sorted.  */
+
+static bfd_boolean
+elf64_alpha_sort_relocs_p (asection *sec)
+{
+  return (sec->flags & SEC_CODE) == 0;
+}
+
+
 /* Handle dynamic relocations when doing an Alpha ELF link.  */
 
 static bfd_boolean
@@ -5518,6 +5530,8 @@ static const struct elf_size_info alpha_elf_size_info =
   elf64_alpha_add_symbol_hook
 #define elf_backend_relocs_compatible \
   _bfd_elf_relocs_compatible
+#define elf_backend_sort_relocs_p \
+  elf64_alpha_sort_relocs_p
 #define elf_backend_check_relocs \
   elf64_alpha_check_relocs
 #define elf_backend_create_dynamic_sections \