diff options
Diffstat (limited to 'bfd/elf32-vax.c')
-rw-r--r-- | bfd/elf32-vax.c | 92 |
1 files changed, 25 insertions, 67 deletions
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 02b69a1..d7c6137 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -561,8 +561,6 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, struct elf_link_hash_entry **sym_hashes; const Elf_Internal_Rela *rel; const Elf_Internal_Rela *rel_end; - asection *sgot; - asection *srelgot; asection *sreloc; if (bfd_link_relocatable (info)) @@ -572,8 +570,6 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, symtab_hdr = &elf_tdata (abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); - sgot = NULL; - srelgot = NULL; sreloc = NULL; rel_end = relocs + sec->reloc_count; @@ -620,31 +616,6 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, return FALSE; } - if (sgot == NULL) - { - sgot = bfd_get_linker_section (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - } - - if (srelgot == NULL - && (h != NULL || bfd_link_pic (info))) - { - srelgot = bfd_get_linker_section (dynobj, ".rela.got"); - if (srelgot == NULL) - { - flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY); - - srelgot = bfd_make_section_anyway_with_flags (dynobj, - ".rela.got", - flags); - if (srelgot == NULL - || !bfd_set_section_alignment (dynobj, srelgot, 2)) - return FALSE; - } - } - if (h != NULL) { struct elf_vax_link_hash_entry *eh; @@ -957,7 +928,7 @@ elf_vax_adjust_dynamic_symbol (struct bfd_link_info *info, return TRUE; } - s = bfd_get_linker_section (dynobj, ".plt"); + s = elf_hash_table (info)->splt; BFD_ASSERT (s != NULL); /* If this is the first .plt entry, make room for the special @@ -987,13 +958,13 @@ elf_vax_adjust_dynamic_symbol (struct bfd_link_info *info, /* We also need to make an entry in the .got.plt section, which will be placed in the .got section by the linker script. */ - s = bfd_get_linker_section (dynobj, ".got.plt"); + s = elf_hash_table (info)->sgotplt; BFD_ASSERT (s != NULL); s->size += 4; /* We also need to make an entry in the .rela.plt section. */ - s = bfd_get_linker_section (dynobj, ".rela.plt"); + s = elf_hash_table (info)->srelplt; BFD_ASSERT (s != NULL); s->size += sizeof (Elf32_External_Rela); @@ -1088,13 +1059,13 @@ elf_vax_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, not actually use these entries. Reset the size of .rela.got and .got, which will cause them to get stripped from the output file below. */ - s = bfd_get_linker_section (dynobj, ".rela.got"); + s = elf_hash_table (info)->srelgot; if (s != NULL) s->size = 0; - s = bfd_get_linker_section (dynobj, ".got.plt"); + s = elf_hash_table (info)->sgotplt; if (s != NULL) s->size = 0; - s = bfd_get_linker_section (dynobj, ".got"); + s = elf_hash_table (info)->sgot; if (s != NULL) s->size = 0; } @@ -1324,8 +1295,8 @@ elf_vax_instantiate_got_entries (struct elf_link_hash_entry *h, void * infoptr) dynobj = elf_hash_table (info)->dynobj; BFD_ASSERT (dynobj != NULL); - sgot = bfd_get_linker_section (dynobj, ".got"); - srelgot = bfd_get_linker_section (dynobj, ".rela.got"); + sgot = elf_hash_table (info)->sgot; + srelgot = elf_hash_table (info)->srelgot; if (SYMBOL_REFERENCES_LOCAL (info, h)) { @@ -1361,7 +1332,6 @@ elf_vax_relocate_section (bfd *output_bfd, Elf_Internal_Sym *local_syms, asection **local_sections) { - bfd *dynobj; Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; bfd_vma plt_index; @@ -1373,7 +1343,6 @@ elf_vax_relocate_section (bfd *output_bfd, Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; - dynobj = elf_hash_table (info)->dynobj; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); @@ -1478,11 +1447,8 @@ elf_vax_relocate_section (bfd *output_bfd, { bfd_vma off; - if (sgot == NULL) - { - sgot = bfd_get_linker_section (dynobj, ".got"); - BFD_ASSERT (sgot != NULL); - } + sgot = elf_hash_table (info)->sgot; + BFD_ASSERT (sgot != NULL); off = h->got.offset; BFD_ASSERT (off < sgot->size); @@ -1517,17 +1483,11 @@ elf_vax_relocate_section (bfd *output_bfd, || h->plt.offset == (bfd_vma) -1) break; - if (splt == NULL) - { - splt = bfd_get_linker_section (dynobj, ".plt"); - BFD_ASSERT (splt != NULL); - } + splt = elf_hash_table (info)->splt; + BFD_ASSERT (splt != NULL); - if (sgotplt == NULL) - { - sgotplt = bfd_get_linker_section (dynobj, ".got.plt"); - BFD_ASSERT (sgotplt != NULL); - } + sgotplt = elf_hash_table (info)->sgotplt; + BFD_ASSERT (sgotplt != NULL); plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; @@ -1782,9 +1742,9 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, it up. */ BFD_ASSERT (h->dynindx != -1); - splt = bfd_get_linker_section (dynobj, ".plt"); - sgot = bfd_get_linker_section (dynobj, ".got.plt"); - srela = bfd_get_linker_section (dynobj, ".rela.plt"); + splt = elf_hash_table (info)->splt; + sgot = elf_hash_table (info)->sgotplt; + srela = elf_hash_table (info)->srelplt; BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL); addend = 2 * (h->plt.offset & 1); @@ -1846,8 +1806,8 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info, /* This symbol has an entry in the global offset table. Set it up. */ - sgot = bfd_get_linker_section (dynobj, ".got"); - srela = bfd_get_linker_section (dynobj, ".rela.got"); + sgot = elf_hash_table (info)->sgot; + srela = elf_hash_table (info)->srelgot; BFD_ASSERT (sgot != NULL && srela != NULL); rela.r_offset = (sgot->output_section->vma @@ -1904,7 +1864,7 @@ elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) dynobj = elf_hash_table (info)->dynobj; - sgot = bfd_get_linker_section (dynobj, ".got.plt"); + sgot = elf_hash_table (info)->sgotplt; BFD_ASSERT (sgot != NULL); sdyn = bfd_get_linker_section (dynobj, ".dynamic"); @@ -1913,7 +1873,7 @@ elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) asection *splt; Elf32_External_Dyn *dyncon, *dynconend; - splt = bfd_get_linker_section (dynobj, ".plt"); + splt = elf_hash_table (info)->splt; BFD_ASSERT (splt != NULL && sdyn != NULL); dyncon = (Elf32_External_Dyn *) sdyn->contents; @@ -1921,7 +1881,6 @@ elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) for (; dyncon < dynconend; dyncon++) { Elf_Internal_Dyn dyn; - const char *name; asection *s; bfd_elf32_swap_dyn_in (dynobj, dyncon, &dyn); @@ -1932,18 +1891,17 @@ elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) break; case DT_PLTGOT: - name = ".got.plt"; + s = elf_hash_table (info)->sgotplt; goto get_vma; case DT_JMPREL: - name = ".rela.plt"; + s = elf_hash_table (info)->srelplt; get_vma: - s = bfd_get_linker_section (dynobj, name); dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; case DT_PLTRELSZ: - s = bfd_get_linker_section (dynobj, ".rela.plt"); + s = elf_hash_table (info)->srelplt; dyn.d_un.d_val = s->size; bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); break; @@ -1956,7 +1914,7 @@ elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) linker script arranges for .rela.plt to follow all other relocation sections, we don't have to worry about changing the DT_RELA entry. */ - s = bfd_get_linker_section (dynobj, ".rela.plt"); + s = elf_hash_table (info)->srelplt; if (s != NULL) dyn.d_un.d_val -= s->size; bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon); |