diff options
Diffstat (limited to 'bfd/elf32-m32c.c')
-rw-r--r-- | bfd/elf32-m32c.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index 44fcc24..c49de84 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -400,17 +400,13 @@ m32c_elf_relocate_section struct elf_link_hash_entry ** sym_hashes; Elf_Internal_Rela * rel; Elf_Internal_Rela * relend; - bfd *dynobj; asection *splt; symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; - dynobj = elf_hash_table (info)->dynobj; - splt = NULL; - if (dynobj != NULL) - splt = bfd_get_linker_section (dynobj, ".plt"); + splt = elf_hash_table (info)->splt; for (rel = relocs; rel < relend; rel ++) { @@ -704,20 +700,18 @@ m32c_elf_check_relocs case R_M32C_16: if (dynobj == NULL) elf_hash_table (info)->dynobj = dynobj = abfd; + splt = elf_hash_table (info)->splt; if (splt == NULL) { - splt = bfd_get_linker_section (dynobj, ".plt"); - if (splt == NULL) - { - flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS - | SEC_IN_MEMORY | SEC_LINKER_CREATED - | SEC_READONLY | SEC_CODE); - splt = bfd_make_section_anyway_with_flags (dynobj, ".plt", - flags); - if (splt == NULL - || ! bfd_set_section_alignment (dynobj, splt, 1)) - return FALSE; - } + flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS + | SEC_IN_MEMORY | SEC_LINKER_CREATED + | SEC_READONLY | SEC_CODE); + splt = bfd_make_section_anyway_with_flags (dynobj, ".plt", + flags); + elf_hash_table (info)->splt = splt; + if (splt == NULL + || ! bfd_set_section_alignment (dynobj, splt, 1)) + return FALSE; } if (h != NULL) @@ -759,14 +753,13 @@ static bfd_boolean m32c_elf_finish_dynamic_sections (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) { - bfd *dynobj; - asection *splt; + bfd *dynobj = elf_hash_table (info)->dynobj; + asection *splt = elf_hash_table (info)->splt; /* As an extra sanity check, verify that all plt entries have been filled in. */ - if ((dynobj = elf_hash_table (info)->dynobj) != NULL - && (splt = bfd_get_linker_section (dynobj, ".plt")) != NULL) + if (dynobj != NULL && splt != NULL) { bfd_byte *contents = splt->contents; unsigned int i, size = splt->size; @@ -794,7 +787,7 @@ m32c_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (dynobj == NULL) return TRUE; - splt = bfd_get_linker_section (dynobj, ".plt"); + splt = elf_hash_table (info)->splt; BFD_ASSERT (splt != NULL); splt->contents = (bfd_byte *) bfd_zalloc (dynobj, splt->size); |