X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf32-visium.c;h=8721b77666a6419a4c794b39b3b8f222e29a498a;hb=9b30da15e72bd4e8265169bfd511272aa3875738;hp=e8f1c4c9e4c27641a019e5fac83815cd91c4224d;hpb=707bad1b21c18cf8e570fb8df8f7c5961fb0f3a5;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf32-visium.c b/bfd/elf32-visium.c index e8f1c4c9e4..8721b77666 100644 --- a/bfd/elf32-visium.c +++ b/bfd/elf32-visium.c @@ -1,6 +1,6 @@ /* Visium-specific support for 32-bit ELF. - Copyright (C) 2003-2018 Free Software Foundation, Inc. + Copyright (C) 2003-2019 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -312,7 +312,6 @@ visium_elf_howto_parity_reloc (bfd * input_bfd, arelent *reloc_entry, bfd_vma relocation; bfd_byte *inplace_address; bfd_vma insn; - const bfd_vma signmask = 0xffff8000; /* This part is from bfd_elf_generic_reloc. If we're relocating, and this an external symbol, we don't want @@ -351,19 +350,19 @@ visium_elf_howto_parity_reloc (bfd * input_bfd, arelent *reloc_entry, if (reloc_entry->howto->pc_relative) { - relocation -= input_section->output_section->vma - + input_section->output_offset; + relocation -= input_section->output_section->vma; + relocation -= input_section->output_offset; relocation -= reloc_entry->address; } switch (reloc_entry->howto->type) { case R_VISIUM_PC16: - relocation >>= 2; - if (ret == bfd_reloc_ok && (relocation & signmask) != 0 - && (relocation & signmask) != signmask) + if (ret == bfd_reloc_ok + && ((bfd_signed_vma) relocation < -0x20000 + || (bfd_signed_vma) relocation > 0x1ffff)) ret = bfd_reloc_overflow; - relocation &= 0xffff; + relocation = (relocation >> 2) & 0xffff; break; case R_VISIUM_HI16: case R_VISIUM_HI16_PCREL: @@ -600,7 +599,7 @@ visium_elf_relocate_section (bfd *output_bfd, 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 { @@ -621,7 +620,7 @@ visium_elf_relocate_section (bfd *output_bfd, or sections discarded by a linker script, we just want the section contents zeroed. Avoid any special processing. */ _bfd_clear_contents (howto, input_bfd, input_section, - contents + rel->r_offset); + contents, rel->r_offset); rel->r_info = 0; rel->r_addend = 0; @@ -723,13 +722,17 @@ visium_elf_gc_mark_hook (asection *sec, struct bfd_link_info *info, return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); } -static void -visium_elf_post_process_headers (bfd *abfd, - struct bfd_link_info *info ATTRIBUTE_UNUSED) +static bfd_boolean +visium_elf_init_file_header (bfd *abfd, struct bfd_link_info *info) { - Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd); - i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_STANDALONE; + Elf_Internal_Ehdr *i_ehdrp; + + if (!_bfd_elf_init_file_header (abfd, info)) + return FALSE; + + i_ehdrp = elf_elfheader (abfd); i_ehdrp->e_ident[EI_ABIVERSION] = 1; + return TRUE; } /* Function to set the ELF flag bits. */ @@ -853,6 +856,7 @@ visium_elf_print_private_bfd_data (bfd *abfd, void *ptr) #define ELF_ARCH bfd_arch_visium #define ELF_MACHINE_CODE EM_VISIUM +#define ELF_OSABI ELFOSABI_STANDALONE #define ELF_MAXPAGESIZE 1 #define TARGET_BIG_SYM visium_elf32_vec @@ -874,6 +878,6 @@ visium_elf_print_private_bfd_data (bfd *abfd, void *ptr) #define bfd_elf32_bfd_copy_private_bfd_data visium_elf_copy_private_bfd_data #define bfd_elf32_bfd_merge_private_bfd_data visium_elf_merge_private_bfd_data #define bfd_elf32_bfd_print_private_bfd_data visium_elf_print_private_bfd_data -#define elf_backend_post_process_headers visium_elf_post_process_headers +#define elf_backend_init_file_header visium_elf_init_file_header #include "elf32-target.h"