diff options
Diffstat (limited to 'bfd/elf32-vax.c')
-rw-r--r-- | bfd/elf32-vax.c | 70 |
1 files changed, 3 insertions, 67 deletions
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index b5c3d89..58a4a8b 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -1029,9 +1029,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) { bfd *dynobj; asection *s; - bfd_boolean plt; bfd_boolean relocs; - bfd_boolean reltext; dynobj = elf_hash_table (info)->dynobj; BFD_ASSERT (dynobj != NULL); @@ -1067,9 +1065,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) /* The check_relocs and adjust_dynamic_symbol entry points have determined the sizes of the various dynamic sections. Allocate memory for them. */ - plt = FALSE; relocs = FALSE; - reltext = FALSE; for (s = dynobj->sections; s != NULL; s = s->next) { const char *name; @@ -1084,33 +1080,14 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) if (strcmp (name, ".plt") == 0) { /* Remember whether there is a PLT. */ - plt = s->size != 0; + ; } else if (CONST_STRNEQ (name, ".rela")) { if (s->size != 0) { - asection *target; - - /* Remember whether there are any reloc sections other - than .rela.plt. */ if (strcmp (name, ".rela.plt") != 0) - { - const char *outname; - - relocs = TRUE; - - /* If this relocation section applies to a read only - section, then we probably need a DT_TEXTREL - entry. .rela.plt is actually associated with - .got.plt, which is never readonly. */ - outname = bfd_section_name (s->output_section); - target = bfd_get_section_by_name (output_bfd, outname + 5); - if (target != NULL - && (target->flags & SEC_READONLY) != 0 - && (target->flags & SEC_ALLOC) != 0) - reltext = TRUE; - } + relocs = TRUE; /* We use the reloc_count field as a counter if we need to copy relocs into the output file. */ @@ -1148,48 +1125,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) return FALSE; } - if (elf_hash_table (info)->dynamic_sections_created) - { - /* Add some entries to the .dynamic section. We fill in the - values later, in elf_vax_finish_dynamic_sections, but we - must add the entries now so that we get the correct size for - the .dynamic section. The DT_DEBUG entry is filled in by the - dynamic linker and used by the debugger. */ -#define add_dynamic_entry(TAG, VAL) \ - _bfd_elf_add_dynamic_entry (info, TAG, VAL) - - if (!bfd_link_pic (info)) - { - if (!add_dynamic_entry (DT_DEBUG, 0)) - return FALSE; - } - - if (plt) - { - if (!add_dynamic_entry (DT_PLTGOT, 0) - || !add_dynamic_entry (DT_PLTRELSZ, 0) - || !add_dynamic_entry (DT_PLTREL, DT_RELA) - || !add_dynamic_entry (DT_JMPREL, 0)) - return FALSE; - } - - if (relocs) - { - if (!add_dynamic_entry (DT_RELA, 0) - || !add_dynamic_entry (DT_RELASZ, 0) - || !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))) - return FALSE; - } - - if (reltext || (info->flags & DF_TEXTREL) != 0) - { - if (!add_dynamic_entry (DT_TEXTREL, 0)) - return FALSE; - } - } -#undef add_dynamic_entry - - return TRUE; + return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs); } /* This function is called via elf_vax_link_hash_traverse if we are |