From 6f4b1afcdc8317280669d020765b8215110c4584 Mon Sep 17 00:00:00 2001 From: Cupertino Miranda Date: Wed, 28 Oct 2015 13:48:00 +0000 Subject: Fix errors in the gas testsuite for the ARC target. bfd * reloc.c (BFD_RELOC_ARC_32_PCREL): New entry. (ARC_TLS_DTPOFF): Arrange it in order. * elf32-arc.c (arc_elf_howto_ini): Update formula. (get_middle_endian_relocation): New function. (PDATA): Define. * bfd-in2.h: Regenerate. * libbfd.h: Likewise. elf * arc-reloc.def (ARC_32_PCREL): New definition. gas * config/tc-arc.c (tokenize_arguments): Avoid creating unused symbols when parsing relocation types. (md_apply_fix): Handle TLS relocations. Fix BFD_RELOC_ARC_32_PCREL relocation. (arc_check_reloc): Emit BFD_RELOC_ARC_32_PCREL relocation. --- bfd/elf32-arc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'bfd/elf32-arc.c') diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index 68a47ca..37a426c 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -229,7 +229,8 @@ static struct reloc_howto_struct elf_arc_howto_table[] = static void arc_elf_howto_init (void) { #define ARC_RELOC_HOWTO(TYPE, VALUE, SIZE, BITSIZE, RELOC_FUNCTION, OVERFLOW, FORMULA) \ - elf_arc_howto_table[TYPE].pc_relative = (strstr (#FORMULA, " P ") != NULL); + elf_arc_howto_table[TYPE].pc_relative = \ + (strstr (#FORMULA, " P ") != NULL || strstr (#FORMULA, " PDATA ") != NULL); #include "elf/arc-reloc.def" } @@ -473,6 +474,17 @@ debug_arc_reloc (struct arc_relocation_data reloc_data) fprintf (stderr, " input section is NULL\n"); } +static ATTRIBUTE_UNUSED bfd_vma +get_middle_endian_relocation (bfd_vma reloc) +{ + bfd_vma ret = + ((reloc & 0xffff0000) >> 16) | + ((reloc & 0xffff) << 16); + return ret; +} + +#define ME(RELOC) (get_middle_endian_reloction(RELOC)) + #define S (reloc_data.sym_value \ + reloc_data.sym_section->output_offset \ + reloc_data.sym_section->output_section->vma) @@ -491,6 +503,11 @@ debug_arc_reloc (struct arc_relocation_data reloc_data) + reloc_data.input_section->output_offset \ + (reloc_data.reloc_offset - (bitsize >= 32 ? 4 : 0)) \ ) & ~0x3) +#define PDATA ( \ + (reloc_data.input_section->output_section->vma \ + + reloc_data.input_section->output_offset \ + + (reloc_data.reloc_offset) \ + ) & ~0x3) #define SECTSTAR (reloc_data.input_section->output_offset) #define SECTSTART (reloc_data.input_section->output_offset) #define _SDA_BASE_ (reloc_data.sdata_begin_symbol_vma) -- cgit v1.1