X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Felf32-ip2k.c;h=c0c8b8ec9a71b2b381ab5e9adf17ab535459b6f8;hb=7ab967941150b2f79fc089893bf51e6bb53d245b;hp=aa935243d9ca69db4616352d3a13922489a6da4f;hpb=0aa13feeeb78fc9323bee329c4d91c30f25de121;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c index aa935243d9..c0c8b8ec9a 100644 --- a/bfd/elf32-ip2k.c +++ b/bfd/elf32-ip2k.c @@ -1,5 +1,5 @@ /* Ubicom IP2xxx specific support for 32-bit ELF - Copyright (C) 2000-2018 Free Software Foundation, Inc. + Copyright (C) 2000-2020 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -638,8 +638,7 @@ adjust_all_relocations (bfd *abfd, { if (!bfd_malloc_and_get_section (abfd, stab, &stabcontents)) { - if (stabcontents != NULL) - free (stabcontents); + free (stabcontents); return; } @@ -1210,28 +1209,24 @@ ip2k_elf_relax_section (bfd *abfd, } } - if (internal_relocs != NULL - && elf_section_data (sec)->relocs != internal_relocs) + if (elf_section_data (sec)->relocs != internal_relocs) free (internal_relocs); return TRUE; error_return: - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) + if (symtab_hdr->contents != (unsigned char *) isymbuf) free (isymbuf); - if (contents != NULL - && elf_section_data (sec)->this_hdr.contents != contents) + if (elf_section_data (sec)->this_hdr.contents != contents) free (contents); - if (internal_relocs != NULL - && elf_section_data (sec)->relocs != internal_relocs) + if (elf_section_data (sec)->relocs != internal_relocs) free (internal_relocs); return FALSE; } /* Set the howto pointer for a IP2K ELF reloc. */ -static void +static bfd_boolean ip2k_info_to_howto_rela (bfd * abfd, arelent * cache_ptr, Elf_Internal_Rela * dst) @@ -1244,9 +1239,11 @@ ip2k_info_to_howto_rela (bfd * abfd, /* xgettext:c-format */ _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, r_type); - r_type = 0; + bfd_set_error (bfd_error_bad_value); + return FALSE; } cache_ptr->howto = & ip2k_elf_howto_table [r_type]; + return TRUE; } /* Perform a single relocation. @@ -1433,7 +1430,7 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else {