/* SPU specific support for 32-bit ELF
- Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2006-2018 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
array, so it must be declared in the order of that type. */
static reloc_howto_type elf_howto_table[] = {
- HOWTO (R_SPU_NONE, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ HOWTO (R_SPU_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_NONE",
FALSE, 0, 0x00000000, FALSE),
- HOWTO (R_SPU_ADDR10, 4, 2, 10, FALSE, 14, complain_overflow_bitfield,
+ HOWTO (R_SPU_ADDR10, 4, 2, 10, FALSE, 14, complain_overflow_bitfield,
bfd_elf_generic_reloc, "SPU_ADDR10",
FALSE, 0, 0x00ffc000, FALSE),
- HOWTO (R_SPU_ADDR16, 2, 2, 16, FALSE, 7, complain_overflow_bitfield,
+ HOWTO (R_SPU_ADDR16, 2, 2, 16, FALSE, 7, complain_overflow_bitfield,
bfd_elf_generic_reloc, "SPU_ADDR16",
FALSE, 0, 0x007fff80, FALSE),
HOWTO (R_SPU_ADDR16_HI, 16, 2, 16, FALSE, 7, complain_overflow_bitfield,
HOWTO (R_SPU_ADDR16_LO, 0, 2, 16, FALSE, 7, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_ADDR16_LO",
FALSE, 0, 0x007fff80, FALSE),
- HOWTO (R_SPU_ADDR18, 0, 2, 18, FALSE, 7, complain_overflow_bitfield,
+ HOWTO (R_SPU_ADDR18, 0, 2, 18, FALSE, 7, complain_overflow_bitfield,
bfd_elf_generic_reloc, "SPU_ADDR18",
FALSE, 0, 0x01ffff80, FALSE),
- HOWTO (R_SPU_ADDR32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
+ HOWTO (R_SPU_ADDR32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_ADDR32",
FALSE, 0, 0xffffffff, FALSE),
- HOWTO (R_SPU_REL16, 2, 2, 16, TRUE, 7, complain_overflow_bitfield,
+ HOWTO (R_SPU_REL16, 2, 2, 16, TRUE, 7, complain_overflow_bitfield,
bfd_elf_generic_reloc, "SPU_REL16",
FALSE, 0, 0x007fff80, TRUE),
- HOWTO (R_SPU_ADDR7, 0, 2, 7, FALSE, 14, complain_overflow_dont,
+ HOWTO (R_SPU_ADDR7, 0, 2, 7, FALSE, 14, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_ADDR7",
FALSE, 0, 0x001fc000, FALSE),
- HOWTO (R_SPU_REL9, 2, 2, 9, TRUE, 0, complain_overflow_signed,
- spu_elf_rel9, "SPU_REL9",
+ HOWTO (R_SPU_REL9, 2, 2, 9, TRUE, 0, complain_overflow_signed,
+ spu_elf_rel9, "SPU_REL9",
FALSE, 0, 0x0180007f, TRUE),
- HOWTO (R_SPU_REL9I, 2, 2, 9, TRUE, 0, complain_overflow_signed,
- spu_elf_rel9, "SPU_REL9I",
+ HOWTO (R_SPU_REL9I, 2, 2, 9, TRUE, 0, complain_overflow_signed,
+ spu_elf_rel9, "SPU_REL9I",
FALSE, 0, 0x0000c07f, TRUE),
- HOWTO (R_SPU_ADDR10I, 0, 2, 10, FALSE, 14, complain_overflow_signed,
+ HOWTO (R_SPU_ADDR10I, 0, 2, 10, FALSE, 14, complain_overflow_signed,
bfd_elf_generic_reloc, "SPU_ADDR10I",
FALSE, 0, 0x00ffc000, FALSE),
- HOWTO (R_SPU_ADDR16I, 0, 2, 16, FALSE, 7, complain_overflow_signed,
+ HOWTO (R_SPU_ADDR16I, 0, 2, 16, FALSE, 7, complain_overflow_signed,
bfd_elf_generic_reloc, "SPU_ADDR16I",
FALSE, 0, 0x007fff80, FALSE),
- HOWTO (R_SPU_REL32, 0, 2, 32, TRUE, 0, complain_overflow_dont,
+ HOWTO (R_SPU_REL32, 0, 2, 32, TRUE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_REL32",
FALSE, 0, 0xffffffff, TRUE),
- HOWTO (R_SPU_ADDR16X, 0, 2, 16, FALSE, 7, complain_overflow_bitfield,
+ HOWTO (R_SPU_ADDR16X, 0, 2, 16, FALSE, 7, complain_overflow_bitfield,
bfd_elf_generic_reloc, "SPU_ADDR16X",
FALSE, 0, 0x007fff80, FALSE),
- HOWTO (R_SPU_PPU32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
+ HOWTO (R_SPU_PPU32, 0, 2, 32, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_PPU32",
FALSE, 0, 0xffffffff, FALSE),
- HOWTO (R_SPU_PPU64, 0, 4, 64, FALSE, 0, complain_overflow_dont,
+ HOWTO (R_SPU_PPU64, 0, 4, 64, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_PPU64",
FALSE, 0, -1, FALSE),
- HOWTO (R_SPU_ADD_PIC, 0, 0, 0, FALSE, 0, complain_overflow_dont,
+ HOWTO (R_SPU_ADD_PIC, 0, 0, 0, FALSE, 0, complain_overflow_dont,
bfd_elf_generic_reloc, "SPU_ADD_PIC",
FALSE, 0, 0x00000000, FALSE),
};
switch (code)
{
default:
+ return (enum elf_spu_reloc_type) -1;
+ case BFD_RELOC_NONE:
return R_SPU_NONE;
case BFD_RELOC_SPU_IMM10W:
return R_SPU_ADDR10;
enum elf_spu_reloc_type r_type;
r_type = (enum elf_spu_reloc_type) ELF32_R_TYPE (dst->r_info);
- BFD_ASSERT (r_type < R_SPU_max);
+ /* PR 17512: file: 90c2a92e. */
+ if (r_type >= R_SPU_max)
+ {
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB: unrecognised SPU reloc number: %d"),
+ abfd, r_type);
+ bfd_set_error (bfd_error_bad_value);
+ r_type = R_SPU_NONE;
+ }
cache_ptr->howto = &elf_howto_table[(int) r_type];
}
{
enum elf_spu_reloc_type r_type = spu_elf_bfd_to_reloc_type (code);
- if (r_type == R_SPU_NONE)
+ if (r_type == (enum elf_spu_reloc_type) -1)
return NULL;
return elf_howto_table + r_type;
{
Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[j];
- if (ELF_IS_SECTION_IN_SEGMENT_MEMORY (shdr, phdr))
+ if (ELF_SECTION_SIZE (shdr, phdr) != 0
+ && ELF_SECTION_IN_SEGMENT (shdr, phdr))
{
asection *sec = shdr->bfd_section;
spu_elf_section_data (sec)->u.o.ovl_index = num_ovl;
{
struct spu_link_hash_table *htab;
- htab = bfd_malloc (sizeof (*htab));
+ htab = bfd_zmalloc (sizeof (*htab));
if (htab == NULL)
return NULL;
return NULL;
}
- memset (&htab->ovtab, 0,
- sizeof (*htab) - offsetof (struct spu_link_hash_table, ovtab));
-
htab->elf.init_got_refcount.refcount = 0;
htab->elf.init_got_refcount.glist = NULL;
htab->elf.init_got_offset.offset = 0;
struct spu_link_hash_table *htab = spu_hash_table (info);
bfd *ibfd;
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
if (bfd_get_section_by_name (ibfd, SPU_PTNOTE_SPUNAME) != NULL)
break;
{
asection *s;
flagword flags;
- ibfd = info->input_bfds;
- flags = SEC_LOAD | SEC_ALLOC | SEC_READONLY | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY;
+
+ if (htab->elf.dynobj == NULL)
+ htab->elf.dynobj = ibfd;
+ ibfd = htab->elf.dynobj;
+ flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED);
s = bfd_make_section_anyway_with_flags (ibfd, ".fixup", flags);
if (s == NULL || !bfd_set_section_alignment (ibfd, s, 2))
return FALSE;
if ((s->vma - vma_start) & (htab->params->line_size - 1))
{
- info->callbacks->einfo (_("%X%P: overlay section %A "
+ info->callbacks->einfo (_("%X%P: overlay section %pA "
"does not start on a cache line.\n"),
s);
bfd_set_error (bfd_error_bad_value);
}
else if (s->size > htab->params->line_size)
{
- info->callbacks->einfo (_("%X%P: overlay section %A "
+ info->callbacks->einfo (_("%X%P: overlay section %pA "
"is larger than a cache line.\n"),
s);
bfd_set_error (bfd_error_bad_value);
s = alloc_sec[i];
if (s->vma < ovl_end)
{
- info->callbacks->einfo (_("%X%P: overlay section %A "
+ info->callbacks->einfo (_("%X%P: overlay section %pA "
"is not in cache area.\n"),
alloc_sec[i-1]);
bfd_set_error (bfd_error_bad_value);
spu_elf_section_data (s)->u.o.ovl_buf = num_buf;
if (s0->vma != s->vma)
{
- info->callbacks->einfo (_("%X%P: overlay sections %A "
- "and %A do not start at the "
+ /* xgettext:c-format */
+ info->callbacks->einfo (_("%X%P: overlay sections %pA "
+ "and %pA do not start at the "
"same address.\n"),
s0, s);
bfd_set_error (bfd_error_bad_value);
sym,
sym_sec);
}
- (*_bfd_error_handler) (_("warning: call to non-function"
- " symbol %s defined in %B"),
- sym_sec->owner, sym_name);
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("warning: call to non-function symbol %s defined in %pB"),
+ sym_name, sym_sec->owner);
}
}
}
/* Support two sizes of overlay stubs, a slower more compact stub of two
- intructions, and a faster stub of four instructions.
+ instructions, and a faster stub of four instructions.
Soft-icache stubs are four or eight words. */
static unsigned int
if (stub_type != br000_ovl_stub
&& lrlive != stub_type - br000_ovl_stub)
- info->callbacks->einfo (_("%A:0x%v lrlive .brinfo (%u) differs "
+ /* xgettext:c-format */
+ info->callbacks->einfo (_("%pA:0x%v lrlive .brinfo (%u) differs "
"from analysis (%u)\n"),
isec, irela->r_offset, lrlive,
stub_type - br000_ovl_stub);
add = (int) irela->r_addend & 0xffffffff;
if (add != 0)
len += 1 + 8;
- name = bfd_malloc (len);
+ name = bfd_malloc (len + 1);
if (name == NULL)
return FALSE;
{
return count_stub (htab, NULL, NULL, nonovl_stub, h, NULL);
}
-
+
return TRUE;
}
return build_stub (info, NULL, NULL, nonovl_stub, h, NULL,
h->root.u.def.value, sym_sec);
}
-
+
return TRUE;
}
struct spu_link_hash_table *htab = spu_hash_table (info);
bfd *ibfd;
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
{
- extern const bfd_target bfd_elf32_spu_vec;
+ extern const bfd_target spu_elf32_vec;
Elf_Internal_Shdr *symtab_hdr;
asection *isec;
Elf_Internal_Sym *local_syms = NULL;
- if (ibfd->xvec != &bfd_elf32_spu_vec)
+ if (ibfd->xvec != &spu_elf32_vec)
continue;
/* We'll need the symbol table in a second. */
return count;
}
+static int
+ovl_mgr_stat (struct bfd *abfd ATTRIBUTE_UNUSED,
+ void *stream,
+ struct stat *sb)
+{
+ struct _ovl_stream *os = (struct _ovl_stream *) stream;
+
+ memset (sb, 0, sizeof (*sb));
+ sb->st_size = (const char *) os->end - (const char *) os->start;
+ return 0;
+}
+
bfd_boolean
spu_elf_open_builtin_lib (bfd **ovl_bfd, const struct _ovl_stream *stream)
{
(void *) stream,
ovl_mgr_pread,
NULL,
- NULL);
+ ovl_mgr_stat);
return *ovl_bfd != NULL;
}
}
else if (h->root.u.def.section->owner != NULL)
{
- (*_bfd_error_handler) (_("%B is not allowed to define %s"),
- h->root.u.def.section->owner,
- h->root.root.string);
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB is not allowed to define %s"),
+ h->root.u.def.section->owner,
+ h->root.root.string);
bfd_set_error (bfd_error_bad_value);
return NULL;
}
else
{
- (*_bfd_error_handler) (_("you are not allowed to define %s in a script"),
- h->root.root.string);
+ _bfd_error_handler (_("you are not allowed to define %s in a script"),
+ h->root.root.string);
bfd_set_error (bfd_error_bad_value);
return NULL;
}
s = h->root.u.def.section->output_section;
if (spu_elf_section_data (s)->u.o.ovl_index)
{
- (*_bfd_error_handler) (_("%s in overlay section"),
- h->root.root.string);
+ _bfd_error_handler (_("%s in overlay section"),
+ h->root.root.string);
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
if (htab->stub_err)
{
- (*_bfd_error_handler) (_("overlay stub relocation overflow"));
+ _bfd_error_handler (_("overlay stub relocation overflow"));
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
{
if (htab->stub_sec[i]->size != htab->stub_sec[i]->rawsize)
{
- (*_bfd_error_handler) (_("stubs don't match calculated size"));
+ _bfd_error_handler (_("stubs don't match calculated size"));
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
htab->local_store = hi + 1 - lo;
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ for (m = elf_seg_map (abfd); m != NULL; m = m->next)
if (m->p_type == PT_LOAD)
for (i = 0; i < m->count; i++)
if (m->sections[i]->size != 0
const char *f1 = func_name (&sinfo->fun[i - 1]);
const char *f2 = func_name (&sinfo->fun[i]);
+ /* xgettext:c-format */
info->callbacks->einfo (_("warning: %s overlaps %s\n"), f1, f2);
sinfo->fun[i - 1].hi = sinfo->fun[i].lo;
}
else
return &sinfo->fun[mid];
}
- info->callbacks->einfo (_("%A:0x%v not found in function table\n"),
+ /* xgettext:c-format */
+ info->callbacks->einfo (_("%pA:0x%v not found in function table\n"),
sec, offset);
bfd_set_error (bfd_error_bad_value);
return NULL;
{
if (!warned)
info->callbacks->einfo
- (_("%B(%A+0x%v): call to non-code section"
- " %B(%A), analysis incomplete\n"),
+ /* xgettext:c-format */
+ (_("%pB(%pA+0x%v): call to non-code section"
+ " %pB(%pA), analysis incomplete\n"),
sec->owner, sec, irela->r_offset,
sym_sec->owner, sym_sec);
warned = TRUE;
bfd_boolean gaps = FALSE;
bfd_idx = 0;
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
bfd_idx++;
psym_arr = bfd_zmalloc (bfd_idx * sizeof (*psym_arr));
sec_arr = bfd_zmalloc (bfd_idx * sizeof (*sec_arr));
if (sec_arr == NULL)
return FALSE;
-
+
for (ibfd = info->input_bfds, bfd_idx = 0;
ibfd != NULL;
- ibfd = ibfd->link_next, bfd_idx++)
+ ibfd = ibfd->link.next, bfd_idx++)
{
- extern const bfd_target bfd_elf32_spu_vec;
+ extern const bfd_target spu_elf32_vec;
Elf_Internal_Shdr *symtab_hdr;
asection *sec;
size_t symcount;
Elf_Internal_Sym *syms, *sy, **psyms, **psy;
asection **psecs, **p;
- if (ibfd->xvec != &bfd_elf32_spu_vec)
+ if (ibfd->xvec != &spu_elf32_vec)
continue;
/* Read all the symbols. */
if (symtab_hdr->contents != NULL)
{
/* Don't use cached symbols since the generic ELF linker
- code only reads local symbols, and we need globals too. */
+ code only reads local symbols, and we need globals too. */
free (symtab_hdr->contents);
symtab_hdr->contents = NULL;
}
relocations. */
for (ibfd = info->input_bfds, bfd_idx = 0;
ibfd != NULL;
- ibfd = ibfd->link_next, bfd_idx++)
+ ibfd = ibfd->link.next, bfd_idx++)
{
asection *sec;
for (ibfd = info->input_bfds, bfd_idx = 0;
ibfd != NULL;
- ibfd = ibfd->link_next, bfd_idx++)
+ ibfd = ibfd->link.next, bfd_idx++)
{
Elf_Internal_Shdr *symtab_hdr;
asection *sec;
}
}
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
{
- extern const bfd_target bfd_elf32_spu_vec;
+ extern const bfd_target spu_elf32_vec;
asection *sec;
- if (ibfd->xvec != &bfd_elf32_spu_vec)
+ if (ibfd->xvec != &spu_elf32_vec)
continue;
/* Some of the symbols we've installed as marking the
for (ibfd = info->input_bfds, bfd_idx = 0;
ibfd != NULL;
- ibfd = ibfd->link_next, bfd_idx++)
+ ibfd = ibfd->link.next, bfd_idx++)
{
if (psym_arr[bfd_idx] == NULL)
continue;
{
bfd *ibfd;
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
{
- extern const bfd_target bfd_elf32_spu_vec;
+ extern const bfd_target spu_elf32_vec;
asection *sec;
- if (ibfd->xvec != &bfd_elf32_spu_vec)
+ if (ibfd->xvec != &spu_elf32_vec)
continue;
for (sec = ibfd->sections; sec != NULL; sec = sec->next)
const char *f1 = func_name (fun);
const char *f2 = func_name (call->fun);
+ /* xgettext:c-format */
info->callbacks->info (_("Stack analysis will ignore the call "
"from %s to %s\n"),
f1, f2);
bfd *ibfd;
unsigned int depth;
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
{
- extern const bfd_target bfd_elf32_spu_vec;
+ extern const bfd_target spu_elf32_vec;
asection *sec;
- if (ibfd->xvec != &bfd_elf32_spu_vec)
+ if (ibfd->xvec != &spu_elf32_vec)
continue;
for (sec = ibfd->sections; sec != NULL; sec = sec->next)
memset (&dummy_caller, 0, sizeof (dummy_caller));
lib_count = 0;
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
{
- extern const bfd_target bfd_elf32_spu_vec;
+ extern const bfd_target spu_elf32_vec;
asection *sec;
- if (ibfd->xvec != &bfd_elf32_spu_vec)
+ if (ibfd->xvec != &spu_elf32_vec)
continue;
for (sec = ibfd->sections; sec != NULL; sec = sec->next)
if (htab->params->stack_analysis)
{
if (!fun->non_root)
- info->callbacks->info (_(" %s: 0x%v\n"), f1, (bfd_vma) cum_stack);
- info->callbacks->minfo (_("%s: 0x%v 0x%v\n"),
+ info->callbacks->info (" %s: 0x%v\n", f1, (bfd_vma) cum_stack);
+ info->callbacks->minfo ("%s: 0x%v 0x%v\n",
f1, (bfd_vma) stack, (bfd_vma) cum_stack);
if (has_call)
const char *ann1 = call->fun == max ? "*" : " ";
const char *ann2 = call->is_tail ? "t" : " ";
- info->callbacks->minfo (_(" %s%s %s\n"), ann1, ann2, f2);
+ info->callbacks->minfo (" %s%s %s\n", ann1, ann2, f2);
}
}
}
bfd *const *abfd1 = a;
bfd *const *abfd2 = b;
- return strcmp ((*abfd1)->filename, (*abfd2)->filename);
+ return filename_cmp ((*abfd1)->filename, (*abfd2)->filename);
}
static unsigned int
struct bfd_link_info *info)
{
unsigned int j;
-
+
for (j = base; j < count && ovly_map[j] == ovlynum; j++)
{
asection *sec = ovly_sections[2 * j];
/* Find the extents of our loadable image. */
lo = (unsigned int) -1;
hi = 0;
- for (m = elf_tdata (info->output_bfd)->segment_map; m != NULL; m = m->next)
+ for (m = elf_seg_map (info->output_bfd); m != NULL; m = m->next)
if (m->p_type == PT_LOAD)
for (i = 0; i < m->count; i++)
if (m->sections[i]->size != 0)
goto err_exit;
bfd_count = 0;
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
++bfd_count;
bfd_arr = bfd_malloc (bfd_count * sizeof (*bfd_arr));
if (bfd_arr == NULL)
count = 0;
bfd_count = 0;
total_overlay_size = 0;
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
{
- extern const bfd_target bfd_elf32_spu_vec;
+ extern const bfd_target spu_elf32_vec;
asection *sec;
unsigned int old_count;
- if (ibfd->xvec != &bfd_elf32_spu_vec)
+ if (ibfd->xvec != &spu_elf32_vec)
continue;
old_count = count;
qsort (bfd_arr, bfd_count, sizeof (*bfd_arr), sort_bfds);
for (i = 1; i < bfd_count; ++i)
- if (strcmp (bfd_arr[i - 1]->filename, bfd_arr[i]->filename) == 0)
+ if (filename_cmp (bfd_arr[i - 1]->filename, bfd_arr[i]->filename) == 0)
{
if (bfd_arr[i - 1]->my_archive == bfd_arr[i]->my_archive)
{
if (bfd_arr[i - 1]->my_archive && bfd_arr[i]->my_archive)
+ /* xgettext:c-format */
info->callbacks->einfo (_("%s duplicated in %s\n"),
bfd_arr[i]->filename,
bfd_arr[i]->my_archive->filename);
}
if (fixed_size + mos_param.max_overlay_size > htab->local_store)
+ /* xgettext:c-format */
info->callbacks->einfo (_("non-overlay size of 0x%v plus maximum overlay "
"size of 0x%v exceeds local store\n"),
(bfd_vma) fixed_size,
if (i == base)
{
- info->callbacks->einfo (_("%B:%A%s exceeds overlay size\n"),
+ /* xgettext:c-format */
+ info->callbacks->einfo (_("%pB:%pA%s exceeds overlay size\n"),
ovly_sections[2 * i]->owner,
ovly_sections[2 * i],
ovly_sections[2 * i + 1] ? " + rodata" : "");
file_err:
bfd_set_error (bfd_error_system_call);
err_exit:
- info->callbacks->einfo ("%F%P: auto overlay error: %E\n");
+ info->callbacks->einfo (_("%F%P: auto overlay error: %E\n"));
xexit (1);
}
|| (htab->params->ovly_flavour == ovly_soft_icache
&& htab->params->lrlive_analysis))
&& !spu_elf_stack_analysis (info))
- info->callbacks->einfo ("%X%P: stack/lrlive analysis error: %E\n");
+ info->callbacks->einfo (_("%X%P: stack/lrlive analysis error: %E\n"));
if (!spu_elf_build_stubs (info))
- info->callbacks->einfo ("%F%P: can not build overlay stubs: %E\n");
+ info->callbacks->einfo (_("%F%P: can not build overlay stubs: %E\n"));
return bfd_elf_final_link (output_bfd, info);
}
-/* Called when not normally emitting relocs, ie. !info->relocatable
+/* Called when not normally emitting relocs, ie. !bfd_link_relocatable (info)
and !info->emitrelocations. Returns a count of special relocs
that need to be emitted. */
if (qaddr != (base & ~(bfd_vma) 15))
{
if ((sfixup->reloc_count + 1) * FIXUP_RECORD_SIZE > sfixup->size)
- (*_bfd_error_handler) (_("fatal error while creating .fixup"));
+ _bfd_error_handler (_("fatal error while creating .fixup"));
FIXUP_PUT (output_bfd, htab, sfixup->reloc_count, qaddr | bit);
sfixup->reloc_count++;
}
bfd_vma addend;
bfd_reloc_status_type r;
bfd_boolean unresolved_reloc;
- bfd_boolean warned;
enum _stub_type stub_type;
r_symndx = ELF32_R_SYM (rel->r_info);
r_type = ELF32_R_TYPE (rel->r_info);
howto = elf_howto_table + r_type;
unresolved_reloc = FALSE;
- warned = FALSE;
h = NULL;
sym = NULL;
sec = NULL;
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ if (info->wrap_hash != NULL
+ && (input_section->flags & SEC_DEBUGGING) != 0)
+ h = ((struct elf_link_hash_entry *)
+ unwrap_hash_lookup (info, input_bfd, &h->root));
+
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
else if (info->unresolved_syms_in_objects == RM_IGNORE
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
;
- else if (!info->relocatable
+ else if (!bfd_link_relocatable (info)
&& !(r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64))
{
bfd_boolean err;
err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT);
- if (!info->callbacks->undefined_symbol (info,
- h->root.root.string,
- input_bfd,
- input_section,
- rel->r_offset, err))
- return FALSE;
- warned = TRUE;
+ (*info->callbacks->undefined_symbol) (info,
+ h->root.root.string,
+ input_bfd,
+ input_section,
+ rel->r_offset, err);
}
sym_name = h->root.root.string;
}
- if (sec != NULL && elf_discarded_section (sec))
- {
- /* For relocs against symbols from removed linkonce sections,
- or sections discarded by a linker script, we just want the
- section contents zeroed. Avoid any special processing. */
- _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
- rel->r_info = 0;
- rel->r_addend = 0;
- continue;
- }
+ if (sec != NULL && discarded_section (sec))
+ RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+ rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
/* Change "a rt,ra,rb" to "ai rt,ra,0". */
&& !(h->def_regular || ELF_COMMON_DEF_P (h)))
{
bfd_byte *loc = contents + rel->r_offset;
- loc[0] = 0x1c;
- loc[1] = 0x00;
+ loc[0] = 0x1c;
+ loc[1] = 0x00;
loc[2] &= 0x3f;
}
}
}
- if (htab->params->emit_fixups && !info->relocatable
+ if (htab->params->emit_fixups && !bfd_link_relocatable (info)
&& (input_section->flags & SEC_ALLOC) != 0
&& r_type == R_SPU_ADDR32)
{
else if (is_ea_sym)
unresolved_reloc = TRUE;
- if (unresolved_reloc)
+ if (unresolved_reloc
+ && _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset) != (bfd_vma) -1)
{
- (*_bfd_error_handler)
- (_("%B(%s+0x%lx): unresolvable %s relocation against symbol `%s'"),
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB(%s+%#Lx): unresolvable %s relocation against symbol `%s'"),
input_bfd,
bfd_get_section_name (input_bfd, input_section),
- (long) rel->r_offset,
+ rel->r_offset,
howto->name,
sym_name);
ret = FALSE;
switch (r)
{
case bfd_reloc_overflow:
- if (!((*info->callbacks->reloc_overflow)
- (info, (h ? &h->root : NULL), sym_name, howto->name,
- (bfd_vma) 0, input_bfd, input_section, rel->r_offset)))
- return FALSE;
+ (*info->callbacks->reloc_overflow)
+ (info, (h ? &h->root : NULL), sym_name, howto->name,
+ (bfd_vma) 0, input_bfd, input_section, rel->r_offset);
break;
case bfd_reloc_undefined:
- if (!((*info->callbacks->undefined_symbol)
- (info, sym_name, input_bfd, input_section,
- rel->r_offset, TRUE)))
- return FALSE;
+ (*info->callbacks->undefined_symbol)
+ (info, sym_name, input_bfd, input_section, rel->r_offset, TRUE);
break;
case bfd_reloc_outofrange:
common_error:
ret = FALSE;
- if (!((*info->callbacks->warning)
- (info, msg, sym_name, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
+ (*info->callbacks->warning) (info, msg, sym_name, input_bfd,
+ input_section, rel->r_offset);
break;
}
}
}
input_section->reloc_count = wrel - relocs;
/* Backflips for _bfd_elf_link_output_relocs. */
- rel_hdr = &elf_section_data (input_section)->rel_hdr;
+ rel_hdr = _bfd_elf_single_rel_hdr (input_section);
rel_hdr->sh_size = input_section->reloc_count * rel_hdr->sh_entsize;
ret = 2;
}
return ret;
}
+static bfd_boolean
+spu_elf_finish_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ return TRUE;
+}
+
/* Adjust _SPUEAR_ syms to point at their overlay stubs. */
static int
{
struct spu_link_hash_table *htab = spu_hash_table (info);
- if (!info->relocatable
+ if (!bfd_link_relocatable (info)
&& htab->stub_sec != NULL
&& h != NULL
&& (h->root.type == bfd_link_hash_defined
/* Set ELF header e_type for plugins. */
static void
-spu_elf_post_process_headers (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
+spu_elf_post_process_headers (bfd *abfd, struct bfd_link_info *info)
{
if (spu_plugin)
{
i_ehdrp->e_type = ET_DYN;
}
+
+ _bfd_elf_post_process_headers (abfd, info);
}
/* We may add an extra PT_LOAD segment for .toe. We also need extra
return TRUE;
toe = bfd_get_section_by_name (abfd, ".toe");
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ for (m = elf_seg_map (abfd); m != NULL; m = m->next)
if (m->p_type == PT_LOAD && m->count > 1)
for (i = 0; i < m->count; i++)
if ((s = m->sections[i]) == toe
as PF_OVERLAY) will be placed into SPU local store on startup. */
/* Move all overlay segments onto a separate list. */
- p = &elf_tdata (abfd)->segment_map;
+ p = &elf_seg_map (abfd);
p_overlay = &m_overlay;
while (*p != NULL)
{
}
/* Re-insert overlay segments at the head of the segment map. */
- *p_overlay = elf_tdata (abfd)->segment_map;
- elf_tdata (abfd)->segment_map = m_overlay;
+ *p_overlay = elf_seg_map (abfd);
+ elf_seg_map (abfd) = m_overlay;
return TRUE;
}
bed = get_elf_backend_data (abfd);
tdata = elf_tdata (abfd);
phdr = tdata->phdr;
- count = tdata->program_header_size / bed->s->sizeof_phdr;
+ count = elf_program_header_size (abfd) / bed->s->sizeof_phdr;
htab = spu_hash_table (info);
if (htab->num_overlays != 0)
{
struct elf_segment_map *m;
unsigned int o;
- for (i = 0, m = elf_tdata (abfd)->segment_map; m; ++i, m = m->next)
+ for (i = 0, m = elf_seg_map (abfd); m; ++i, m = m->next)
if (m->count != 0
&& (o = spu_elf_section_data (m->sections[0])->u.o.ovl_index) != 0)
{
bfd *ibfd;
size_t size;
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
{
asection *isec;
bfd_vma base_end;
/* If there aren't any relocs, then there's nothing more
- to do. */
- if ((isec->flags & SEC_RELOC) == 0
+ to do. */
+ if ((isec->flags & SEC_ALLOC) == 0
+ || (isec->flags & SEC_RELOC) == 0
|| isec->reloc_count == 0)
continue;
return FALSE;
/* 1 quadword can contain up to 4 R_SPU_ADDR32
- relocations. They are stored in a single word by
- saving the upper 28 bits of the address and setting the
- lower 4 bits to a bit mask of the words that have the
- relocation. BASE_END keeps track of the next quadword. */
+ relocations. They are stored in a single word by
+ saving the upper 28 bits of the address and setting the
+ lower 4 bits to a bit mask of the words that have the
+ relocation. BASE_END keeps track of the next quadword. */
irela = internal_relocs;
irelaend = irela + isec->reloc_count;
base_end = 0;
return TRUE;
}
-#define TARGET_BIG_SYM bfd_elf32_spu_vec
+#define TARGET_BIG_SYM spu_elf32_vec
#define TARGET_BIG_NAME "elf32-spu"
#define ELF_ARCH bfd_arch_spu
+#define ELF_TARGET_ID SPU_ELF_DATA
#define ELF_MACHINE_CODE EM_SPU
/* This matches the alignment need for DMA. */
#define ELF_MAXPAGESIZE 0x80
-#define elf_backend_rela_normal 1
+#define elf_backend_rela_normal 1
#define elf_backend_can_gc_sections 1
#define bfd_elf32_bfd_reloc_type_lookup spu_elf_reloc_type_lookup
#define elf_info_to_howto spu_elf_info_to_howto
#define elf_backend_count_relocs spu_elf_count_relocs
#define elf_backend_relocate_section spu_elf_relocate_section
+#define elf_backend_finish_dynamic_sections spu_elf_finish_dynamic_sections
#define elf_backend_symbol_processing spu_elf_backend_symbol_processing
#define elf_backend_link_output_symbol_hook spu_elf_output_symbol_hook
#define elf_backend_object_p spu_elf_object_p
#define elf_backend_additional_program_headers spu_elf_additional_program_headers
#define elf_backend_modify_segment_map spu_elf_modify_segment_map
#define elf_backend_modify_program_headers spu_elf_modify_program_headers
-#define elf_backend_post_process_headers spu_elf_post_process_headers
+#define elf_backend_post_process_headers spu_elf_post_process_headers
#define elf_backend_fake_sections spu_elf_fake_sections
#define elf_backend_special_sections spu_elf_special_sections
#define bfd_elf32_bfd_final_link spu_elf_final_link