X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf32-xstormy16.c;h=af4175cd8aa8e3cba7eadc878015c578e781c897;hb=aebcde5eb475befba571ca9ae7b6c58126d41160;hp=7eae51ca42cbc42255b827b4a11dab2ac47f3c56;hpb=b90efa5b79ac1524ec260f8eb89d1be37e0219a7;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index 7eae51ca42..af4175cd8a 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -1,5 +1,5 @@ /* Xstormy16-specific support for 32-bit ELF. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2017 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -73,11 +73,11 @@ static reloc_howto_type xstormy16_elf_howto_table [] = /* This reloc does nothing. */ HOWTO (R_XSTORMY16_NONE, /* type */ 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ + 3, /* size (0 = byte, 1 = short, 2 = long) */ + 0, /* bitsize */ FALSE, /* pc_relative */ 0, /* bitpos */ - complain_overflow_bitfield, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_XSTORMY16_NONE", /* name */ FALSE, /* partial_inplace */ @@ -334,7 +334,7 @@ xstormy16_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED, { unsigned int i; - for (i = ARRAY_SIZE (xstormy16_reloc_map); --i;) + for (i = ARRAY_SIZE (xstormy16_reloc_map); i--;) { const reloc_map * entry; @@ -411,13 +411,12 @@ xstormy16_elf_check_relocs (bfd *abfd, asection *splt; bfd *dynobj; - if (info->relocatable) + if (bfd_link_relocatable (info)) return TRUE; symtab_hdr = &elf_tdata(abfd)->symtab_hdr; sym_hashes = elf_sym_hashes (abfd); local_plt_offsets = elf_local_got_offsets (abfd); - splt = NULL; dynobj = elf_hash_table(info)->dynobj; relend = relocs + sec->reloc_count; @@ -457,21 +456,19 @@ xstormy16_elf_check_relocs (bfd *abfd, 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) @@ -589,7 +586,7 @@ xstormy16_elf_relax_section (bfd *dynobj, /* Assume nothing changes. */ *again = FALSE; - if (info->relocatable) + if (bfd_link_relocatable (info)) return TRUE; /* We only relax the .plt section at the moment. */ @@ -712,14 +709,14 @@ xstormy16_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, bfd *dynobj; asection *splt; - if (info->relocatable) + if (bfd_link_relocatable (info)) return TRUE; dynobj = elf_hash_table (info)->dynobj; 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_zalloc (dynobj, splt->size); @@ -773,17 +770,13 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNU 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 ++) { @@ -829,7 +822,7 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNU RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, rel, 1, relend, howto, 0, contents); - if (info->relocatable) + if (bfd_link_relocatable (info)) continue; if (h != NULL) @@ -920,15 +913,14 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNU switch (r) { case bfd_reloc_overflow: - r = info->callbacks->reloc_overflow + (*info->callbacks->reloc_overflow) (info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0, input_bfd, input_section, rel->r_offset); break; case bfd_reloc_undefined: - r = info->callbacks->undefined_symbol - (info, name, input_bfd, input_section, rel->r_offset, - TRUE); + (*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, rel->r_offset, TRUE); break; case bfd_reloc_outofrange: @@ -949,11 +941,8 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNU } if (msg) - r = info->callbacks->warning - (info, msg, name, input_bfd, input_section, rel->r_offset); - - if (! r) - return FALSE; + (*info->callbacks->warning) (info, msg, name, input_bfd, + input_section, rel->r_offset); } } @@ -966,14 +955,13 @@ static bfd_boolean xstormy16_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;