diff options
author | Alan Modra <amodra@gmail.com> | 2001-09-29 06:21:59 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2001-09-29 06:21:59 +0000 |
commit | 51b64d56a7c65e6a30649cf9aade57b56c321c0e (patch) | |
tree | 92f1f675368a87f2f181589c5df4a599575e54fb /bfd/elf32-m68k.c | |
parent | 21d17a588f70a57acf7d97def74a550e2925600e (diff) | |
download | gdb-51b64d56a7c65e6a30649cf9aade57b56c321c0e.zip gdb-51b64d56a7c65e6a30649cf9aade57b56c321c0e.tar.gz gdb-51b64d56a7c65e6a30649cf9aade57b56c321c0e.tar.bz2 |
* elf-bfd.h (struct elf_link_local_dynamic_entry): Add init_refcount.
(struct elf_backend_data): Add can_refcount.
* elf.c (_bfd_elf_link_hash_newfunc): Get rid of a few casts. Set
got.refcount and plt.refcount from init_refcount.
(_bfd_elf_link_hash_table_init): Set up init_refcount.
(_bfd_elf_link_hash_copy_indirect): Reference got/plt.refcount
rather than got/plt.offset, and test for <= 0 rather than -1.
* elflink.h (size_dynamic_sections): Set init_refcount to -1.
* elfxx-target.h (elf_backend_can_refcount): Define.
(elfNN_bed): Init can_refcount.
* linker.c (_bfd_link_hash_newfunc): Get rid of a few casts.
(_bfd_generic_link_hash_newfunc): Likewise.
* elf32-cris.c (cris_elf_check_relocs): Modify for refcounts
starting from zero.
(elf_backend_can_refcount): Define.
* elf32-hppa.c (elf32_hppa_check_relocs): Modify for refcounts
starting from zero.
(elf32_hppa_copy_indirect_symbol): Make static to agree with
prototype.
(elf_backend_can_refcount): Define.
* elf32-i386.c (elf_i386_check_relocs): Modify for refcounts
starting from zero.
(allocate_dynrelocs): Set plt/got.offset rather than *.refcount.
(elf_i386_finish_dynamic_symbol): Expand SHN_UNDEF comment.
(elf_i386_finish_dynamic_sections): Use local var so line < 80 chars.
(elf_backend_can_refcount): Define.
(elf_i386_copy_indirect_symbol): Make static to agree with
prototype. Formatting fix.
* elf32-m68k.c (elf_m68k_check_relocs): Modify for refcounts
starting from zero.
(elf_backend_can_refcount): Define.
* elf32-ppc.c (ppc_elf_check_relocs): Modify for refcounts
starting from zero.
(elf_backend_can_refcount): Define.
* elf32-s390.c (elf_s390_check_relocs): Modify for refcounts
starting from zero.
(elf_backend_can_refcount): Define.
* elf64-s390.c (elf_s390_check_relocs): Modify for refcounts
starting from zero.
(elf_backend_can_refcount): Define.
* elf64-x86-64.c (elf64_x86_64_check_relocs): Modify for refcounts
starting from zero.
(elf_backend_can_refcount): Define.
Diffstat (limited to 'bfd/elf32-m68k.c')
-rw-r--r-- | bfd/elf32-m68k.c | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 80613f1..c325224 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -534,10 +534,8 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) if (h != NULL) { - if (h->got.refcount == -1) + if (h->got.refcount == 0) { - h->got.refcount = 1; - /* Make sure this symbol is output as a dynamic symbol. */ if (h->dynindx == -1) { @@ -550,8 +548,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) /* Allocate relocation space. */ srelgot->_raw_size += sizeof (Elf32_External_Rela); } - else - h->got.refcount++; + h->got.refcount++; } else { @@ -563,16 +560,13 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) size = symtab_hdr->sh_info; size *= sizeof (bfd_signed_vma); local_got_refcounts = ((bfd_signed_vma *) - bfd_alloc (abfd, size)); + bfd_zalloc (abfd, size)); if (local_got_refcounts == NULL) return false; elf_local_got_refcounts (abfd) = local_got_refcounts; - memset (local_got_refcounts, -1, (size_t) size); } - if (local_got_refcounts[r_symndx] == -1) + if (local_got_refcounts[r_symndx] == 0) { - local_got_refcounts[r_symndx] = 1; - sgot->_raw_size += 4; if (info->shared) { @@ -582,8 +576,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) srelgot->_raw_size += sizeof (Elf32_External_Rela); } } - else - local_got_refcounts[r_symndx]++; + local_got_refcounts[r_symndx]++; } break; @@ -603,10 +596,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) continue; h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; + h->plt.refcount++; break; case R_68K_PLT8O: @@ -631,10 +621,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) } h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT; - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; + h->plt.refcount++; break; case R_68K_PC8: @@ -662,10 +649,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) /* Make sure a plt entry is created for this symbol if it turns out to be a function defined by a dynamic object. */ - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; + h->plt.refcount++; } break; } @@ -677,10 +661,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) { /* Make sure a plt entry is created for this symbol if it turns out to be a function defined by a dynamic object. */ - if (h->plt.refcount == -1) - h->plt.refcount = 1; - else - h->plt.refcount++; + h->plt.refcount++; } /* If we are creating a shared library, we need to copy the @@ -2357,6 +2338,7 @@ elf32_m68k_reloc_type_class (rela) #define elf_backend_reloc_type_class elf32_m68k_reloc_type_class #define elf_backend_can_gc_sections 1 +#define elf_backend_can_refcount 1 #define elf_backend_want_got_plt 1 #define elf_backend_plt_readonly 1 #define elf_backend_want_plt_sym 0 |