/* BFD back-end for National Semiconductor's CR16 ELF
- Copyright (C) 2007-2018 Free Software Foundation, Inc.
+ Copyright (C) 2007-2019 Free Software Foundation, Inc.
Written by M R Swami Reddy.
This file is part of BFD, the Binary File Descriptor library.
#include "libiberty.h"
#include "elf-bfd.h"
#include "elf/cr16.h"
+#include "elf32-cr16.h"
/* The cr16 linker needs to keep track of the number of relocs that
it decides to copy in check_relocs for each symbol. This is so
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
htab->sgot= s;
if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, ptralign))
+ || !bfd_set_section_alignment (s, ptralign))
return FALSE;
if (bed->want_got_plt)
s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
htab->sgotplt = s;
if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, ptralign))
+ || !bfd_set_section_alignment (s, ptralign))
return FALSE;
}
/* Retrieve a howto ptr using an internal relocation entry. */
-static void
+static bfd_boolean
elf_cr16_info_to_howto (bfd *abfd, arelent *cache_ptr,
Elf_Internal_Rela *dst)
{
_bfd_error_handler (_("%pB: unsupported relocation type %#x"),
abfd, r_type);
bfd_set_error (bfd_error_bad_value);
- r_type = R_CR16_NONE;
+ return FALSE;
}
cache_ptr->howto = cr16_elf_howto_table + r_type;
+ return TRUE;
}
/* Look through the relocs for a section during the first phase.
name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0')
- name = bfd_section_name (input_bfd, sec);
+ name = bfd_section_name (sec);
}
switch (r)
file. This gets the CR16 architecture right based on the machine
number. */
-static void
-_bfd_cr16_elf_final_write_processing (bfd *abfd,
- bfd_boolean linker ATTRIBUTE_UNUSED)
+static bfd_boolean
+_bfd_cr16_elf_final_write_processing (bfd *abfd)
{
unsigned long val;
switch (bfd_get_mach (abfd))
val = EM_CR16;
break;
}
-
-
- elf_elfheader (abfd)->e_flags |= val;
+ elf_elfheader (abfd)->e_flags |= val;
+ return _bfd_elf_final_write_processing (abfd);
}
flags | SEC_READONLY);
htab->srelplt = s;
if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, ptralign))
+ || !bfd_set_section_alignment (s, ptralign))
return FALSE;
if (! _bfd_cr16_elf_create_got_section (abfd, info))
? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_alignment (abfd, s, ptralign))
+ || !bfd_set_section_alignment (s, ptralign))
return FALSE;
}
}
/* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */
- name = bfd_get_section_name (dynobj, s);
+ name = bfd_section_name (s);
if (strcmp (name, ".plt") == 0)
{
entry. The entries in the .rela.plt section
really apply to the .got section, which we
created ourselves and so know is not readonly. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
+ 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
#define bfd_elf32_bfd_reloc_type_lookup elf_cr16_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup elf_cr16_reloc_name_lookup
#define elf_info_to_howto elf_cr16_info_to_howto
-#define elf_info_to_howto_rel 0
+#define elf_info_to_howto_rel NULL
#define elf_backend_relocate_section elf32_cr16_relocate_section
#define bfd_elf32_bfd_relax_section elf32_cr16_relax_section
#define bfd_elf32_bfd_get_relocated_section_contents \