/* Xtensa-specific support for 32-bit ELF.
- Copyright (C) 2003-2015 Free Software Foundation, Inc.
+ Copyright (C) 2003-2016 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
static int internal_reloc_compare (const void *, const void *);
static int internal_reloc_matches (const void *, const void *);
static asection *xtensa_get_property_section (asection *, const char *);
-extern asection *xtensa_make_property_section (asection *, const char *);
static flagword xtensa_get_property_predef_flags (asection *);
/* Other functions called directly by the linker. */
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;
}
static const bfd_byte elf_xtensa_be_plt_entry[PLT_ENTRY_SIZE] =
{
+#if XSHAL_ABI == XTHAL_ABI_WINDOWED
0x6c, 0x10, 0x04, /* entry sp, 32 */
+#endif
0x18, 0x00, 0x00, /* l32r a8, [got entry for rtld's resolver] */
0x1a, 0x00, 0x00, /* l32r a10, [got entry for rtld's link map] */
0x1b, 0x00, 0x00, /* l32r a11, [literal for reloc index] */
static const bfd_byte elf_xtensa_le_plt_entry[PLT_ENTRY_SIZE] =
{
+#if XSHAL_ABI == XTHAL_ABI_WINDOWED
0x36, 0x41, 0x00, /* entry sp, 32 */
+#endif
0x81, 0x00, 0x00, /* l32r a8, [got entry for rtld's resolver] */
0xa1, 0x00, 0x00, /* l32r a10, [got entry for rtld's link map] */
0xb1, 0x00, 0x00, /* l32r a11, [literal for reloc index] */
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)
{
- (*_bfd_error_handler) (_("%B(%A): invalid property table"),
- abfd, section);
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%B(%A): invalid property table"),
+ abfd, section);
bfd_set_error (bfd_error_bad_value);
free (blocks);
return -1;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
- if (info->relocatable || (sec->flags & SEC_ALLOC) == 0)
+ if (bfd_link_relocatable (info) || (sec->flags & SEC_ALLOC) == 0)
return TRUE;
BFD_ASSERT (is_xtensa_elf (abfd));
if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
{
- (*_bfd_error_handler) (_("%B: bad symbol index: %d"),
- abfd, r_symndx);
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%B: bad symbol index: %d"),
+ abfd, r_symndx);
return FALSE;
}
switch (r_type)
{
case R_XTENSA_TLSDESC_FN:
- if (info->shared)
+ if (bfd_link_pic (info))
{
tls_type = GOT_TLS_GD;
is_got = TRUE;
break;
case R_XTENSA_TLSDESC_ARG:
- if (info->shared)
+ if (bfd_link_pic (info))
{
tls_type = GOT_TLS_GD;
is_got = TRUE;
break;
case R_XTENSA_TLS_DTPOFF:
- if (info->shared)
+ if (bfd_link_pic (info))
tls_type = GOT_TLS_GD;
else
tls_type = GOT_TLS_IE;
case R_XTENSA_TLS_TPOFF:
tls_type = GOT_TLS_IE;
- if (info->shared)
+ if (bfd_link_pic (info))
info->flags |= DF_STATIC_TLS;
- if (info->shared || h)
+ if (bfd_link_pic (info) || h)
is_got = TRUE;
break;
tls_type |= old_tls_type;
else
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("%B: `%s' accessed both as normal and thread local symbol"),
abfd,
h ? h->root.root.string : "<local>");
elf_xtensa_make_sym_local (struct bfd_link_info *info,
struct elf_link_hash_entry *h)
{
- if (info->shared)
+ if (bfd_link_pic (info))
{
if (h->plt.refcount > 0)
{
if (htab == NULL)
return FALSE;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
if ((sec->flags & SEC_ALLOC) == 0)
switch (r_type)
{
case R_XTENSA_TLSDESC_FN:
- if (info->shared)
+ if (bfd_link_pic (info))
{
is_got = TRUE;
is_tlsfunc = TRUE;
break;
case R_XTENSA_TLSDESC_ARG:
- if (info->shared)
+ if (bfd_link_pic (info))
is_got = TRUE;
else
{
break;
case R_XTENSA_TLS_TPOFF:
- if (info->shared || h)
+ if (bfd_link_pic (info) || h)
is_got = TRUE;
break;
{
if (is_plt)
{
+ /* If the symbol has been localized its plt.refcount got moved
+ to got.refcount. Handle it as GOT. */
if (h->plt.refcount > 0)
h->plt.refcount--;
+ else
+ is_got = TRUE;
}
- else if (is_got)
+ if (is_got)
{
if (h->got.refcount > 0)
h->got.refcount--;
/* 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);
/* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
+ if (bfd_link_executable (info) && !info->nointerp)
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == 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
/* If we are generating a shared object, we also need space in
".rela.got" for R_XTENSA_RELATIVE relocs for literals that
reference local symbols. */
- if (info->shared)
+ if (bfd_link_pic (info))
elf_xtensa_allocate_local_got_size (info);
/* Allocate space in ".plt" to match the size of ".rela.plt". For
#define add_dynamic_entry(TAG, VAL) \
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (info->executable)
+ if (bfd_link_executable (info))
{
if (!add_dynamic_entry (DT_DEBUG, 0))
return FALSE;
{
asection *splt, *sgotplt;
bfd_vma plt_base, got_base;
- bfd_vma code_offset, lit_offset;
+ bfd_vma code_offset, lit_offset, abi_offset;
int chunk;
chunk = reloc_index / PLT_ENTRIES_PER_CHUNK;
? elf_xtensa_be_plt_entry
: elf_xtensa_le_plt_entry),
PLT_ENTRY_SIZE);
+ abi_offset = XSHAL_ABI == XTHAL_ABI_WINDOWED ? 3 : 0;
bfd_put_16 (output_bfd, l32r_offset (got_base + 0,
- plt_base + code_offset + 3),
- splt->contents + code_offset + 4);
+ plt_base + code_offset + abi_offset),
+ splt->contents + code_offset + abi_offset + 1);
bfd_put_16 (output_bfd, l32r_offset (got_base + 4,
- plt_base + code_offset + 6),
- splt->contents + code_offset + 7);
+ plt_base + code_offset + abi_offset + 3),
+ splt->contents + code_offset + abi_offset + 4);
bfd_put_16 (output_bfd, l32r_offset (got_base + lit_offset,
- plt_base + code_offset + 9),
- splt->contents + code_offset + 10);
+ plt_base + code_offset + abi_offset + 6),
+ splt->contents + code_offset + abi_offset + 7);
return plt_base + code_offset;
}
unresolved_reloc = FALSE;
warned = FALSE;
- if (howto->partial_inplace && !info->relocatable)
+ if (howto->partial_inplace && !bfd_link_relocatable (info))
{
/* Because R_XTENSA_32 was made partial_inplace to fix some
problems with DWARF info in partial links, there may be
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
bfd_vma dest_addr;
asection * sym_sec = get_elf_r_symndx_section (input_bfd, r_symndx);
r = contract_asm_expansion (contents, input_size, rel,
&error_message);
if (r != bfd_reloc_ok)
- {
- if (!((*info->callbacks->reloc_dangerous)
- (info, error_message, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
- }
+ (*info->callbacks->reloc_dangerous)
+ (info, error_message,
+ input_bfd, input_section, rel->r_offset);
+
r_type = ELF32_R_TYPE (rel->r_info);
}
}
}
if (r != bfd_reloc_ok)
- {
- if (!((*info->callbacks->reloc_dangerous)
- (info, error_message, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
- }
+ (*info->callbacks->reloc_dangerous)
+ (info, error_message,
+ input_bfd, input_section, rel->r_offset);
/* Done with work for relocatable link; continue with next reloc. */
continue;
if (rel->r_offset >= input_size
&& ELF32_R_TYPE (rel->r_info) != R_XTENSA_NONE)
{
- (*_bfd_error_handler)
+ _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);
|| h->root.type == bfd_link_hash_defweak)
&& IS_XTENSA_TLS_RELOC (r_type) != (sym_type == STT_TLS))
{
- (*_bfd_error_handler)
+ _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,
case R_XTENSA_PLT:
if (elf_hash_table (info)->dynamic_sections_created
&& (input_section->flags & SEC_ALLOC) != 0
- && (dynamic_symbol || info->shared))
+ && (dynamic_symbol || bfd_link_pic (info)))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
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);
{
error_message =
_("dynamic relocation in read-only section");
- if (!((*info->callbacks->reloc_dangerous)
- (info, error_message, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
+ (*info->callbacks->reloc_dangerous)
+ (info, error_message,
+ input_bfd, input_section, rel->r_offset);
}
if (dynamic_symbol)
case R_XTENSA_TLS_TPOFF:
/* Switch to LE model for local symbols in an executable. */
- if (! info->shared && ! dynamic_symbol)
+ if (! bfd_link_pic (info) && ! dynamic_symbol)
{
relocation = tpoff (info, relocation);
break;
{
if (r_type == R_XTENSA_TLSDESC_FN)
{
- if (! info->shared || (tls_type & GOT_TLS_IE) != 0)
+ if (! bfd_link_pic (info) || (tls_type & GOT_TLS_IE) != 0)
r_type = R_XTENSA_NONE;
}
else if (r_type == R_XTENSA_TLSDESC_ARG)
{
- if (info->shared)
+ if (bfd_link_pic (info))
{
if ((tls_type & GOT_TLS_IE) != 0)
r_type = R_XTENSA_TLS_TPOFF;
{
error_message =
_("TLS relocation invalid without dynamic sections");
- if (!((*info->callbacks->reloc_dangerous)
- (info, error_message, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
+ (*info->callbacks->reloc_dangerous)
+ (info, error_message,
+ input_bfd, input_section, rel->r_offset);
}
else
{
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
{
error_message =
_("dynamic relocation in read-only section");
- if (!((*info->callbacks->reloc_dangerous)
- (info, error_message, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
+ (*info->callbacks->reloc_dangerous)
+ (info, error_message,
+ input_bfd, input_section, rel->r_offset);
}
indx = h && h->dynindx != -1 ? h->dynindx : 0;
break;
case R_XTENSA_TLS_DTPOFF:
- if (! info->shared)
+ if (! bfd_link_pic (info))
/* Switch from LD model to LE model. */
relocation = tpoff (info, relocation);
else
(h && elf_xtensa_hash_entry (h) == htab->tlsbase);
if (! replace_tls_insn (rel, input_bfd, input_section, contents,
is_ld_model, &error_message))
- {
- if (!((*info->callbacks->reloc_dangerous)
- (info, error_message, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
- }
+ (*info->callbacks->reloc_dangerous)
+ (info, error_message,
+ input_bfd, input_section, rel->r_offset);
if (r_type != R_XTENSA_TLS_ARG || is_ld_model)
{
error_message =
vsprint_msg ("invalid relocation for dynamic symbol", ": %s",
strlen (name) + 2, name);
- if (!((*info->callbacks->reloc_dangerous)
- (info, error_message, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
+ (*info->callbacks->reloc_dangerous)
+ (info, error_message, input_bfd, input_section, rel->r_offset);
continue;
}
break;
&& _bfd_elf_section_offset (output_bfd, info, input_section,
rel->r_offset) != (bfd_vma) -1)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
input_bfd,
input_section,
strlen (name) + 22,
name, (int) rel->r_addend);
- if (!((*info->callbacks->reloc_dangerous)
- (info, error_message, input_bfd, input_section,
- rel->r_offset)))
- return FALSE;
+ (*info->callbacks->reloc_dangerous)
+ (info, error_message, input_bfd, input_section, rel->r_offset);
}
}
sgotloc_size = sgotloc->size;
if (sgotloc_size != section_size)
{
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("internal inconsistency in size of .got.loc section"));
return -1;
}
/* 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);
}
/* Combine adjacent literal table entries. */
- BFD_ASSERT (! info->relocatable);
+ BFD_ASSERT (! bfd_link_relocatable (info));
sxtlit = bfd_get_section_by_name (output_bfd, ".xt.lit");
sgotloc = htab->sgotloc;
BFD_ASSERT (sgotloc);
break;
case DT_XTENSA_GOT_LOC_OFF:
- dyn.d_un.d_ptr = htab->sgotloc->output_section->vma;
+ dyn.d_un.d_ptr = (htab->sgotloc->output_section->vma
+ + htab->sgotloc->output_offset);
break;
case DT_PLTGOT:
- dyn.d_un.d_ptr = htab->sgot->output_section->vma;
+ 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;
+ 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->output_section->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->output_section->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. */
in_mach = in_flag & EF_XTENSA_MACH;
if (out_mach != in_mach)
{
- (*_bfd_error_handler)
+ _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);
entry_end - ebb->end_offset);
if (insn_block_len != (entry_end - ebb->end_offset))
{
- (*_bfd_error_handler)
+ _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;
ebb->start_offset - block_begin);
if (insn_block_len != ebb->start_offset - block_begin)
{
- (*_bfd_error_handler)
+ _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;
/* For relocatable sections, we can only simplify when the output
section of the target is the same as the output section of the
source. */
- if (link_info->relocatable
+ if (bfd_link_relocatable (link_info)
&& (target_sec->output_section != sec->output_section
|| is_reloc_sym_weak (abfd, irel)))
return FALSE;
simplify_size = get_asm_simplify_size (contents, sec_size, r_offset);
if (simplify_size == 0)
{
- (*_bfd_error_handler)
+ _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;
return TRUE;
decode_error:
- (*_bfd_error_handler)
+ _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;
sec_size = bfd_get_section_limit (abfd, sec);
final_static_link =
- (!link_info->relocatable
+ (!bfd_link_relocatable (link_info)
&& !elf_hash_table (link_info)->dynamic_sections_created);
/* The placement algorithm first checks to see if the literal is
/* For relocatable links, do not try to move literals. To do it
correctly might increase the number of relocations in an input
section making the default relocatable linking fail. */
- if (!link_info->relocatable && !literal_placed
+ if (!bfd_link_relocatable (link_info) && !literal_placed
&& values->has_last_loc && !(*last_loc_is_prev_p))
{
asection *target_sec = r_reloc_get_section (&values->last_loc);
if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT)
&& (input_section->flags & SEC_ALLOC) != 0
- && (dynamic_symbol || info->shared))
+ && (dynamic_symbol || bfd_link_pic (info)))
{
asection *srel;
bfd_boolean is_plt = 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);
bfd_put_32 (abfd, lit->value, contents + offset);
/* Currently, we cannot move relocations during a relocatable link. */
- BFD_ASSERT (!link_info->relocatable);
+ BFD_ASSERT (!bfd_link_relocatable (link_info));
fix = reloc_bfd_fix_init (sec, offset, r_type,
r_reloc_get_section (r_rel),
r_rel->target_offset + r_rel->virtual_offset,
finish_dynamic_sections() but at that point it's too late to
reclaim the space in the output section, so we do this twice. */
- if (internal_relocs && (!link_info->relocatable
+ if (internal_relocs && (!bfd_link_relocatable (link_info)
|| xtensa_is_littable_section (sec)))
{
Elf_Internal_Rela *last_irel = NULL;
{
if (r_type != R_XTENSA_ASM_EXPAND)
{
- (*_bfd_error_handler)
+ _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