/* Xtensa-specific support for 32-bit ELF.
- Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ Copyright (C) 2003-2017 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
if (r_type >= (unsigned int) R_XTENSA_max)
{
+ /* xgettext:c-format */
_bfd_error_handler (_("%B: invalid XTENSA reloc number: %d"), abfd, r_type);
r_type = 0;
}
struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */
- asection *sgot;
- asection *sgotplt;
- asection *srelgot;
- asection *splt;
- asection *srelplt;
asection *sgotloc;
asection *spltlittbl;
if (blocks[blk - 1].address == blocks[blk].address &&
blocks[blk - 1].size != 0)
{
+ /* xgettext:c-format */
_bfd_error_handler (_("%B(%A): invalid property table"),
abfd, section);
bfd_set_error (bfd_error_bad_value);
if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
{
+ /* xgettext:c-format */
_bfd_error_handler (_("%B: bad symbol index: %d"),
abfd, r_symndx);
return FALSE;
else
{
_bfd_error_handler
+ /* xgettext:c-format */
(_("%B: `%s' accessed both as normal and thread local symbol"),
abfd,
h ? h->root.root.string : "<local>");
/* First do all the standard stuff. */
if (! _bfd_elf_create_dynamic_sections (dynobj, info))
return FALSE;
- htab->splt = bfd_get_linker_section (dynobj, ".plt");
- htab->srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
- htab->sgot = bfd_get_linker_section (dynobj, ".got");
- htab->sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- htab->srelgot = bfd_get_linker_section (dynobj, ".rela.got");
/* Create any extra PLT sections in case check_relocs has already
been called on all the non-dynamic input files. */
flags = noalloc_flags | SEC_ALLOC | SEC_LOAD;
/* Mark the ".got.plt" section READONLY. */
- if (htab->sgotplt == NULL
- || ! bfd_set_section_flags (dynobj, htab->sgotplt, flags))
+ if (htab->elf.sgotplt == NULL
+ || ! bfd_set_section_flags (dynobj, htab->elf.sgotplt, flags))
return FALSE;
/* Create ".got.loc" (literal tables for use by dynamic linker). */
elf_xtensa_make_sym_local (info, h);
if (h->plt.refcount > 0)
- htab->srelplt->size += (h->plt.refcount * sizeof (Elf32_External_Rela));
+ htab->elf.srelplt->size += (h->plt.refcount * sizeof (Elf32_External_Rela));
if (h->got.refcount > 0)
- htab->srelgot->size += (h->got.refcount * sizeof (Elf32_External_Rela));
+ htab->elf.srelgot->size += (h->got.refcount * sizeof (Elf32_External_Rela));
return TRUE;
}
}
if (local_got_refcounts[j] > 0)
- htab->srelgot->size += (local_got_refcounts[j]
- * sizeof (Elf32_External_Rela));
+ htab->elf.srelgot->size += (local_got_refcounts[j]
+ * sizeof (Elf32_External_Rela));
}
}
}
dynobj = elf_hash_table (info)->dynobj;
if (dynobj == NULL)
abort ();
- srelgot = htab->srelgot;
- srelplt = htab->srelplt;
+ srelgot = htab->elf.srelgot;
+ srelplt = htab->elf.srelplt;
if (elf_hash_table (info)->dynamic_sections_created)
{
- BFD_ASSERT (htab->srelgot != NULL
- && htab->srelplt != NULL
- && htab->sgot != NULL
+ BFD_ASSERT (htab->elf.srelgot != NULL
+ && htab->elf.srelplt != NULL
+ && htab->elf.sgot != NULL
&& htab->spltlittbl != NULL
&& htab->sgotloc != NULL);
}
/* Allocate room for one word in ".got". */
- htab->sgot->size = 4;
+ htab->elf.sgot->size = 4;
/* Allocate space in ".rela.got" for literals that reference global
symbols and space in ".rela.plt" for literals that have PLT
&& ELF32_R_TYPE (rel->r_info) != R_XTENSA_NONE)
{
_bfd_error_handler
+ /* xgettext:c-format */
(_("%B(%A+0x%lx): relocation offset out of range (size=0x%x)"),
input_bfd, input_section, rel->r_offset, input_size);
bfd_set_error (bfd_error_bad_value);
{
_bfd_error_handler
((sym_type == STT_TLS
+ /* xgettext:c-format */
? _("%B(%A+0x%lx): %s used with TLS symbol %s")
+ /* xgettext:c-format */
: _("%B(%A+0x%lx): %s used with non-TLS symbol %s")),
input_bfd,
input_section,
asection *srel;
if (dynamic_symbol && r_type == R_XTENSA_PLT)
- srel = htab->srelplt;
+ srel = htab->elf.srelplt;
else
- srel = htab->srelgot;
+ srel = htab->elf.srelgot;
BFD_ASSERT (srel != NULL);
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
- asection *srel = htab->srelgot;
+ asection *srel = htab->elf.srelgot;
int indx;
outrel.r_offset = (input_section->output_section->vma
rel->r_offset) != (bfd_vma) -1)
{
_bfd_error_handler
+ /* xgettext:c-format */
(_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
input_bfd,
input_section,
/* Set the first entry in the global offset table to the address of
the dynamic section. */
- sgot = htab->sgot;
+ sgot = htab->elf.sgot;
if (sgot)
{
BFD_ASSERT (sgot->size == 4);
sgot->contents);
}
- srelplt = htab->srelplt;
+ srelplt = htab->elf.srelplt;
if (srelplt && srelplt->size != 0)
{
asection *sgotplt, *srelgot, *spltlittbl;
bfd_byte *loc;
unsigned rtld_reloc;
- srelgot = htab->srelgot;
+ srelgot = htab->elf.srelgot;
spltlittbl = htab->spltlittbl;
BFD_ASSERT (srelgot != NULL && spltlittbl != NULL);
break;
case DT_PLTGOT:
- dyn.d_un.d_ptr = (htab->sgot->output_section->vma
- + htab->sgot->output_offset);
+ dyn.d_un.d_ptr = (htab->elf.sgot->output_section->vma
+ + htab->elf.sgot->output_offset);
break;
case DT_JMPREL:
- dyn.d_un.d_ptr = (htab->srelplt->output_section->vma
- + htab->srelplt->output_offset);
+ dyn.d_un.d_ptr = (htab->elf.srelplt->output_section->vma
+ + htab->elf.srelplt->output_offset);
break;
case DT_PLTRELSZ:
- dyn.d_un.d_val = htab->srelplt->size;
- break;
-
- case DT_RELASZ:
- /* Adjust RELASZ to not include JMPREL. This matches what
- glibc expects and what is done for several other ELF
- targets (e.g., i386, alpha), but the "correct" behavior
- seems to be unresolved. Since the linker script arranges
- for .rela.plt to follow all other relocation sections, we
- don't have to worry about changing the DT_RELA entry. */
- if (htab->srelplt)
- dyn.d_un.d_val -= htab->srelplt->size;
+ dyn.d_un.d_val = htab->elf.srelplt->size;
break;
}
object file when linking. */
static bfd_boolean
-elf_xtensa_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
+elf_xtensa_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
{
+ bfd *obfd = info->output_bfd;
unsigned out_mach, in_mach;
flagword out_flag, in_flag;
/* Check if we have the same endianness. */
- if (!_bfd_generic_verify_endian_match (ibfd, obfd))
+ if (!_bfd_generic_verify_endian_match (ibfd, info))
return FALSE;
/* Don't even pretend to support mixed-format linking. */
if (out_mach != in_mach)
{
_bfd_error_handler
+ /* xgettext:c-format */
(_("%B: incompatible machine type. Output is 0x%x. Input is 0x%x"),
ibfd, out_mach, in_mach);
bfd_set_error (bfd_error_wrong_format);
if (insn_block_len != (entry_end - ebb->end_offset))
{
_bfd_error_handler
+ /* xgettext:c-format */
(_("%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"),
ebb->sec->owner, ebb->sec, ebb->end_offset + insn_block_len);
return FALSE;
if (insn_block_len != ebb->start_offset - block_begin)
{
_bfd_error_handler
+ /* xgettext:c-format */
(_("%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"),
ebb->sec->owner, ebb->sec, ebb->end_offset + insn_block_len);
return FALSE;
if (simplify_size == 0)
{
_bfd_error_handler
+ /* xgettext:c-format */
(_("%B(%A+0x%lx): could not decode instruction for XTENSA_ASM_SIMPLIFY relocation; possible configuration mismatch"),
sec->owner, sec, r_offset);
continue;
decode_error:
_bfd_error_handler
+ /* xgettext:c-format */
(_("%B(%A+0x%lx): could not decode instruction; possible configuration mismatch"),
ebb->sec->owner, ebb->sec, offset);
return FALSE;
if (dynamic_symbol && r_type == R_XTENSA_PLT)
{
- srel = htab->srelplt;
+ srel = htab->elf.srelplt;
is_plt = TRUE;
}
else
- srel = htab->srelgot;
+ srel = htab->elf.srelgot;
/* Reduce size of the .rela.* section by one reloc. */
BFD_ASSERT (srel != NULL);
if (reloc_index % PLT_ENTRIES_PER_CHUNK == 0)
{
/* The two magic GOT entries for that chunk can go away. */
- srelgot = htab->srelgot;
+ srelgot = htab->elf.srelgot;
BFD_ASSERT (srelgot != NULL);
srelgot->reloc_count -= 2;
srelgot->size -= 2 * sizeof (Elf32_External_Rela);
if (r_type != R_XTENSA_ASM_EXPAND)
{
_bfd_error_handler
+ /* xgettext:c-format */
(_("%B(%A+0x%lx): unexpected fix for %s relocation"),
input_bfd, input_section, rel->r_offset,
elf_howto_table[r_type].name);
static asection *
elf_xtensa_get_plt_section (struct bfd_link_info *info, int chunk)
{
- struct elf_xtensa_link_hash_table *htab;
bfd *dynobj;
char plt_name[10];
if (chunk == 0)
- {
- htab = elf_xtensa_hash_table (info);
- if (htab == NULL)
- return NULL;
-
- return htab->splt;
- }
+ return elf_hash_table (info)->splt;
dynobj = elf_hash_table (info)->dynobj;
sprintf (plt_name, ".plt.%u", chunk);
static asection *
elf_xtensa_get_gotplt_section (struct bfd_link_info *info, int chunk)
{
- struct elf_xtensa_link_hash_table *htab;
bfd *dynobj;
char got_name[14];
if (chunk == 0)
- {
- htab = elf_xtensa_hash_table (info);
- if (htab == NULL)
- return NULL;
- return htab->sgotplt;
- }
+ return elf_hash_table (info)->sgotplt;
dynobj = elf_hash_table (info)->dynobj;
sprintf (got_name, ".got.plt.%u", chunk);
/* Find the corresponding ".got.plt*" section. */
if (sec->name[4] == '\0')
- sgotplt = bfd_get_linker_section (sec->owner, ".got.plt");
+ sgotplt = elf_hash_table (link_info)->sgotplt;
else
{
char got_name[14];
#define elf_backend_got_header_size 4
#define elf_backend_want_dynbss 0
#define elf_backend_want_got_plt 1
+#define elf_backend_dtrel_excludes_plt 1
#define elf_info_to_howto elf_xtensa_info_to_howto_rela