Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions bfd/elfnn-arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1291,10 +1291,8 @@ arc_special_overflow_checks (const struct arc_relocation_data reloc_data,
(bfd_signed_vma) (reloc_data.sym_section->output_section->vma)
#define JLI (bfd_signed_vma) (reloc_data.sym_section->output_section->vma)
#define _SDA_BASE_ (bfd_signed_vma) (reloc_data.sdata_begin_symbol_vma)
#define TLS_REL (bfd_signed_vma) \
((elf_hash_table (info))->tls_sec->output_section->vma)
#define TLS_TBSS (align_power(TCB_SIZE, \
reloc_data.sym_section->alignment_power))
#define TLS_REL (bfd_signed_vma)(tls_sec->output_section->vma)
#define TLS_TBSS (align_power (TCB_SIZE, tls_sec->alignment_power))
#define ICARRY insn
#define DEREFP (insn)

Expand Down Expand Up @@ -1375,6 +1373,7 @@ arc_do_relocation (bfd_byte * contents,
bfd * abfd = reloc_data.input_section->owner;
struct elf_link_hash_table *htab ATTRIBUTE_UNUSED = elf_hash_table (info);
bfd_reloc_status_type flag;
asection *tls_sec = htab->tls_sec;

if (!reloc_data.should_relocate)
return bfd_reloc_ok;
Expand Down Expand Up @@ -1409,6 +1408,19 @@ arc_do_relocation (bfd_byte * contents,

orig_insn = insn;

/* If we resolve a TLS relocation, make sure we do have a valid TLS
section. */
switch (reloc_data.howto->type)
{
case R_ARC_TLS_LE_32:
if (tls_sec == NULL)
return bfd_reloc_notsupported;
break;

default:
break;
}

switch (reloc_data.howto->type)
{
#include "elf/arc-reloc.def"
Expand Down