/* 32-bit ELF support for C-SKY.
- Copyright (C) 1998-2019 Free Software Foundation, Inc.
+ Copyright (C) 1998-2020 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
This file is part of BFD, the Binary File Descriptor library.
#include "opcode/csky.h"
#include <assert.h>
#include "libiberty.h"
+#include "elf32-csky.h"
/* Data structures used for merging different arch variants.
V1 (510/610) and V2 (8xx) processors are incompatible, but
csky_elf_link_hash_table_create (bfd *abfd)
{
struct csky_elf_link_hash_table *ret;
- bfd_size_type amt = sizeof (struct csky_elf_link_hash_table);
+ size_t amt = sizeof (struct csky_elf_link_hash_table);
ret = (struct csky_elf_link_hash_table*) bfd_zmalloc (amt);
if (ret == NULL)
if (htab->elf.hplt != NULL)
strip_section = FALSE;
}
- else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rel") )
+ else if (CONST_STRNEQ (bfd_section_name (s), ".rel") )
{
if (s->size != 0 )
relocs = TRUE;
p = *head;
if (p == NULL || p->sec != sec)
{
- bfd_size_type amt = sizeof *p;
+ size_t amt = sizeof *p;
p = ((struct elf_dyn_relocs *)
bfd_alloc (htab->elf.dynobj, amt));
if (p == NULL)
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_CKCORE_GNU_VTENTRY:
- BFD_ASSERT (h != NULL);
- if (h != NULL
- && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
return FALSE;
break;
}
continue;
/* Reverse the list: we must avoid placing stubs at the
- beginning of the section because the beginning of the text
- section may be required for an interrupt vector in bare metal
- code. */
+ beginning of the section because the beginning of the text
+ section may be required for an interrupt vector in bare metal
+ code. */
#define NEXT_SEC PREV_SEC
head = NULL;
while (tail != NULL)
if (r_type >= (unsigned int) R_CKCORE_MAX)
{
bfd_set_error (bfd_error_bad_value);
-error_ret_free_internal:
+ error_ret_free_internal:
if (elf_section_data (section)->relocs == NULL)
free (internal_relocs);
goto error_ret_free_local;
}
return TRUE;
-error_ret_free_local:
+ error_ret_free_local:
return FALSE;
}
stub_entry = (struct elf32_csky_stub_hash_entry *)gen_entry;
info = (struct bfd_link_info *) in_arg;
+ /* Fail if the target section could not be assigned to an output
+ section. The user should fix his linker script. */
+ if (stub_entry->target_section->output_section == NULL
+ && info->non_contiguous_regions)
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ "Retry without --enable-non-contiguous-regions.\n"),
+ stub_entry->target_section);
+
globals = csky_elf_hash_table (info);
if (globals == NULL)
return FALSE;
unsigned int top_id, top_index;
asection *section;
asection **input_list, **list;
- bfd_size_type amt;
+ size_t amt;
struct csky_elf_link_hash_table *htab = csky_elf_hash_table (info);
if (!htab)
{
h->got.offset |= 1;
if (GENERATE_RELATIVE_RELOC_P (info, h))
- relative_reloc = TRUE;
+ relative_reloc = TRUE;
}
}
bfd_put_32 (output_bfd, relocation,
if (name == NULL)
break;
if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
+ name = bfd_section_name (sec);
}
(*info->callbacks->reloc_overflow)
(info,