aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorCupertino Miranda <cmiranda@synopsys.com>2015-10-28 13:48:00 +0000
committerNick Clifton <nickc@redhat.com>2015-10-28 13:48:00 +0000
commit6f4b1afcdc8317280669d020765b8215110c4584 (patch)
treeb6365ff26a33f93899421909914d54c7e69e7721 /bfd
parent7963511fbf0459fff586c3129705bfbc706770e3 (diff)
downloadfsf-binutils-gdb-6f4b1afcdc8317280669d020765b8215110c4584.zip
fsf-binutils-gdb-6f4b1afcdc8317280669d020765b8215110c4584.tar.gz
fsf-binutils-gdb-6f4b1afcdc8317280669d020765b8215110c4584.tar.bz2
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog9
-rw-r--r--bfd/bfd-in2.h1
-rw-r--r--bfd/elf32-arc.c19
-rw-r--r--bfd/libbfd.h1
-rw-r--r--bfd/reloc.c2
5 files changed, 31 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3f9a3de..8101a67e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,12 @@
+2015-10-28 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * reloc.c (BFD_RELOC_ARC_32_PCREL): New entry.
+ * elf32-arc.c (arc_elf_howto_ini): Update formula.
+ (get_middle_endian_relocation): New function.
+ (PDATA): Define.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Likewise.
+
2015-10-28 Alan Modra <amodra@gmail.com>
PR ld/19162
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 85fa3ab..e2e247d 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -3684,6 +3684,7 @@ pc-relative or some form of GOT-indirect relocation. */
BFD_RELOC_ARC_SECTOFF_1,
BFD_RELOC_ARC_SECTOFF_2,
BFD_RELOC_ARC_SDA16_ST2,
+ BFD_RELOC_ARC_32_PCREL,
BFD_RELOC_ARC_PC32,
BFD_RELOC_ARC_GOT32,
BFD_RELOC_ARC_GOTPC32,
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)
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 57300e9..eef13c5 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -1707,6 +1707,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_ARC_SECTOFF_1",
"BFD_RELOC_ARC_SECTOFF_2",
"BFD_RELOC_ARC_SDA16_ST2",
+ "BFD_RELOC_ARC_32_PCREL",
"BFD_RELOC_ARC_PC32",
"BFD_RELOC_ARC_GOT32",
"BFD_RELOC_ARC_GOTPC32",
diff --git a/bfd/reloc.c b/bfd/reloc.c
index aa3d24f..fad9d21 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -3603,6 +3603,8 @@ ENUMX
ENUMX
BFD_RELOC_ARC_SDA16_ST2
ENUMX
+ BFD_RELOC_ARC_32_PCREL
+ENUMX
BFD_RELOC_ARC_PC32
ENUMX
BFD_RELOC_ARC_GOT32