From 6f4b1afcdc8317280669d020765b8215110c4584 Mon Sep 17 00:00:00 2001
From: Cupertino Miranda <cmiranda@synopsys.com>
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.
---
 include/elf/arc-reloc.def | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

(limited to 'include/elf/arc-reloc.def')

diff --git a/include/elf/arc-reloc.def b/include/elf/arc-reloc.def
index e2ff871..893291f 100644
--- a/include/elf/arc-reloc.def
+++ b/include/elf/arc-reloc.def
@@ -1,4 +1,3 @@
-
 ARC_RELOC_HOWTO(ARC_NONE, 0, \
                 2, \
                 32, \
@@ -286,6 +285,13 @@ ARC_RELOC_HOWTO(ARC_SDA16_ST2, 48, \
                 signed, \
                 ( ( ( S + A ) - _SDA_BASE_ ) >> 2 ))
 
+ARC_RELOC_HOWTO(ARC_32_PCREL, 49, \
+                2, \
+                32, \
+                replace_word32, \
+                signed, \
+                ( ( S + A ) - PDATA ))
+
 ARC_RELOC_HOWTO(ARC_PC32, 50, \
                 2, \
                 32, \
@@ -377,42 +383,42 @@ ARC_RELOC_HOWTO(ARC_TLS_DTPMOD, 66, \
                 dont, \
                 0)
 
-ARC_RELOC_HOWTO(ARC_TLS_DTPOFF, 67, \
+ARC_RELOC_HOWTO(ARC_TLS_TPOFF, 68, \
                 2, \
                 32, \
                 replace_word32, \
                 dont, \
                 0)
 
-ARC_RELOC_HOWTO(ARC_TLS_TPOFF, 68, \
+ARC_RELOC_HOWTO(ARC_TLS_GD_GOT, 69, \
                 2, \
                 32, \
                 replace_word32, \
                 dont, \
                 0)
 
-ARC_RELOC_HOWTO(ARC_TLS_GD_GOT, 69, \
+ARC_RELOC_HOWTO(ARC_TLS_GD_LD, 70, \
                 2, \
                 32, \
                 replace_word32, \
                 dont, \
                 0)
 
-ARC_RELOC_HOWTO(ARC_TLS_GD_LD, 70, \
+ARC_RELOC_HOWTO(ARC_TLS_GD_CALL, 71, \
                 2, \
                 32, \
                 replace_word32, \
                 dont, \
                 0)
 
-ARC_RELOC_HOWTO(ARC_TLS_GD_CALL, 71, \
+ARC_RELOC_HOWTO(ARC_TLS_IE_GOT, 72, \
                 2, \
                 32, \
                 replace_word32, \
                 dont, \
                 0)
 
-ARC_RELOC_HOWTO(ARC_TLS_IE_GOT, 72, \
+ARC_RELOC_HOWTO(ARC_TLS_DTPOFF, 67, \
                 2, \
                 32, \
                 replace_word32, \
-- 
cgit v1.1

