diff options
Diffstat (limited to 'bfd/elf32-nds32.c')
-rw-r--r-- | bfd/elf32-nds32.c | 65 |
1 files changed, 17 insertions, 48 deletions
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 65e430cee1e..bfd21aecbe6 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -192,26 +192,6 @@ struct elf_nds32_pcrel_relocs_copied bfd_size_type count; }; -/* The sh linker needs to keep track of the number of relocs that it - decides to copy as dynamic relocs in check_relocs for each symbol. - This is so that it can later discard them if they are found to be - unnecessary. We store the information in a field extending the - regular ELF linker hash table. */ - -struct elf_nds32_dyn_relocs -{ - struct elf_nds32_dyn_relocs *next; - - /* The input section of the reloc. */ - asection *sec; - - /* Total number of relocs copied for the input section. */ - bfd_size_type count; - - /* Number of pc-relative relocs copied for the input section. */ - bfd_size_type pc_count; -}; - /* Nds32 ELF linker hash entry. */ struct elf_nds32_link_hash_entry @@ -219,7 +199,7 @@ struct elf_nds32_link_hash_entry struct elf_link_hash_entry root; /* Track dynamic relocs copied for this symbol. */ - struct elf_nds32_dyn_relocs *dyn_relocs; + struct elf_dyn_relocs *dyn_relocs; /* For checking relocation type. */ #define GOT_UNKNOWN 0 @@ -3473,8 +3453,8 @@ nds32_elf_copy_indirect_symbol (struct bfd_link_info *info, { if (edir->dyn_relocs != NULL) { - struct elf_nds32_dyn_relocs **pp; - struct elf_nds32_dyn_relocs *p; + struct elf_dyn_relocs **pp; + struct elf_dyn_relocs *p; if (ind->root.type == bfd_link_hash_indirect) abort (); @@ -3483,7 +3463,7 @@ nds32_elf_copy_indirect_symbol (struct bfd_link_info *info, list. Merge any entries against the same section. */ for (pp = &eind->dyn_relocs; (p = *pp) != NULL;) { - struct elf_nds32_dyn_relocs *q; + struct elf_dyn_relocs *q; for (q = edir->dyn_relocs; q != NULL; q = q->next) if (q->sec == p->sec) @@ -3511,7 +3491,7 @@ nds32_elf_copy_indirect_symbol (struct bfd_link_info *info, static asection * readonly_dynrelocs (struct elf_link_hash_entry *h) { - struct elf_nds32_dyn_relocs *p; + struct elf_dyn_relocs *p; for (p = elf32_nds32_hash_entry (h)->dyn_relocs; p != NULL; p = p->next) { @@ -3534,8 +3514,6 @@ nds32_elf_adjust_dynamic_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h) { struct elf_nds32_link_hash_table *htab; - struct elf_nds32_link_hash_entry *eh; - struct elf_nds32_dyn_relocs *p; bfd *dynobj; asection *s; unsigned int power_of_two; @@ -3602,24 +3580,15 @@ nds32_elf_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; /* If -z nocopyreloc was given, we won't generate them either. */ - if (info->nocopyreloc) + if (0 && info->nocopyreloc) { h->non_got_ref = 0; return TRUE; } - eh = (struct elf_nds32_link_hash_entry *) h; - for (p = eh->dyn_relocs; p != NULL; p = p->next) - { - s = p->sec->output_section; - if (s != NULL && (s->flags & (SEC_READONLY | SEC_HAS_CONTENTS)) != 0) - break; - } - - /* If we didn't find any dynamic relocs in sections which needs the - copy reloc, then we'll be keeping the dynamic relocs and avoiding - the copy reloc. */ - if (p == NULL) + /* If we don't find any dynamic relocs in read-only sections, then + we'll be keeping the dynamic relocs and avoiding the copy reloc. */ + if (0 && !readonly_dynrelocs (h)) { h->non_got_ref = 0; return TRUE; @@ -3686,7 +3655,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) struct bfd_link_info *info; struct elf_nds32_link_hash_table *htab; struct elf_nds32_link_hash_entry *eh; - struct elf_nds32_dyn_relocs *p; + struct elf_dyn_relocs *p; if (h->root.type == bfd_link_hash_indirect) return TRUE; @@ -3800,7 +3769,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { if (h->def_regular && (h->forced_local || info->symbolic)) { - struct elf_nds32_dyn_relocs **pp; + struct elf_dyn_relocs **pp; for (pp = &eh->dyn_relocs; (p = *pp) != NULL;) { @@ -3924,9 +3893,9 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, for (s = ibfd->sections; s != NULL; s = s->next) { - struct elf_nds32_dyn_relocs *p; + struct elf_dyn_relocs *p; - for (p = ((struct elf_nds32_dyn_relocs *) + for (p = ((struct elf_dyn_relocs *) elf_section_data (s)->local_dynrel); p != NULL; p = p->next) { @@ -6352,8 +6321,8 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, && (h->root.type == bfd_link_hash_defweak || !h->def_regular))) { - struct elf_nds32_dyn_relocs *p; - struct elf_nds32_dyn_relocs **head; + struct elf_dyn_relocs *p; + struct elf_dyn_relocs **head; if (dynobj == NULL) htab->root.dynobj = dynobj = abfd; @@ -6415,14 +6384,14 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, return FALSE; vpp = &elf_section_data (s)->local_dynrel; - head = (struct elf_nds32_dyn_relocs **) vpp; + head = (struct elf_dyn_relocs **) vpp; } p = *head; if (p == NULL || p->sec != sec) { bfd_size_type amt = sizeof (*p); - p = (struct elf_nds32_dyn_relocs *) bfd_alloc (dynobj, amt); + p = (struct elf_dyn_relocs *) bfd_alloc (dynobj, amt); if (p == NULL) return FALSE; p->next = *head; |