GNU Binutils with patches for OS216
Revision | 8a9e8e72fe88095043d16f8a56b5a1e150ee288b (tree) |
---|---|
Zeit | 2016-08-27 09:12:09 |
Autor | Alan Modra <amodra@gmai...> |
Commiter | Alan Modra |
Fix commit 980aa3e6
Commit 980aa3e6 was supposed to cure dyn_reloc counting problems, but
did the opposite. For PIC we count two types of dyn_reloc, those on
pc-relative relocs, and the total. If a sym needs pc-relative dyn
relocs then all the relocs are dynamic. If not, then only those that
are must_be_dyn_reloc are dynamic.
PR 20519
* elf64-ppc.c (pc_dynrelocs): New function.
(ppc64_elf_relocate_section): Use it and must_be_dyn_reloc to
handle pic dynamic relocs.
@@ -1,3 +1,10 @@ | ||
1 | +2016-08-27 Alan Modra <amodra@gmail.com> | |
2 | + | |
3 | + PR 20519 | |
4 | + * elf64-ppc.c (pc_dynrelocs): New function. | |
5 | + (ppc64_elf_relocate_section): Use it and must_be_dyn_reloc to | |
6 | + handle pic dynamic relocs. | |
7 | + | |
1 | 8 | 2016-08-26 Thomas Preud'homme <thomas.preudhomme@arm.com> |
2 | 9 | |
3 | 10 | * bfd-in.h (struct elf32_arm_params): Define. |
@@ -7173,6 +7173,19 @@ alias_readonly_dynrelocs (struct elf_link_hash_entry *h) | ||
7173 | 7173 | return FALSE; |
7174 | 7174 | } |
7175 | 7175 | |
7176 | +/* Return whether EH has pc-relative dynamic relocs. */ | |
7177 | + | |
7178 | +static bfd_boolean | |
7179 | +pc_dynrelocs (struct ppc_link_hash_entry *eh) | |
7180 | +{ | |
7181 | + struct elf_dyn_relocs *p; | |
7182 | + | |
7183 | + for (p = eh->dyn_relocs; p != NULL; p = p->next) | |
7184 | + if (p->pc_count != 0) | |
7185 | + return TRUE; | |
7186 | + return FALSE; | |
7187 | +} | |
7188 | + | |
7176 | 7189 | /* Return true if a global entry stub will be created for H. Valid |
7177 | 7190 | for ELFv2 before plt entries have been allocated. */ |
7178 | 7191 |
@@ -14745,10 +14758,11 @@ ppc64_elf_relocate_section (bfd *output_bfd, | ||
14745 | 14758 | if (NO_OPD_RELOCS && is_opd) |
14746 | 14759 | break; |
14747 | 14760 | |
14748 | - if (h != NULL | |
14749 | - ? h->dyn_relocs != NULL | |
14750 | - : (bfd_link_pic (info) | |
14751 | - ? must_be_dyn_reloc (info, r_type) | |
14761 | + if (bfd_link_pic (info) | |
14762 | + ? ((h != NULL && pc_dynrelocs (h)) | |
14763 | + || must_be_dyn_reloc (info, r_type)) | |
14764 | + : (h != NULL | |
14765 | + ? h->dyn_relocs != NULL | |
14752 | 14766 | : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)) |
14753 | 14767 | { |
14754 | 14768 | bfd_boolean skip, relocate; |