summaryrefslogtreecommitdiff
path: root/packages/binutils/2.25.1/0021-xtensa-fix-signedness-of-gas-relocations.patch
blob: 77b4af39c86ccb624417b34f5e216baa45848c6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From 6c7c5c477ef9ccf2d2548cf2ac3cec9bd3c9c5b6 Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Tue, 2 Feb 2016 17:11:38 +0300
Subject: [PATCH] xtensa: fix signedness of gas relocations

Change 1058c7532d0b "Use signed data type for R_XTENSA_DIFF* relocation
offsets." changed signedness of BFD_RELOC_XTENSA_DIFF* relocations
substituted for BFD_RELOC_*. This made it impossible to encode arbitrary
8-, 16- and 32-bit values, which broke e.g. debug info encoding by .loc
directive. Revert this part and add test.

gas/
2016-02-03  Max Filippov  <jcmvbkbc@gmail.com>
	* config/tc-xtensa.c (md_apply_fix): Mark BFD_RELOC_XTENSA_DIFF*
	substitutions for BFD_RELOC_* as unsigned.
	* gas/testsuite/gas/xtensa/all.exp: Add loc to list of xtensa
	tests.
	* gas/testsuite/gas/xtensa/loc.d: New file: loc test result
	patterns.
	* gas/testsuite/gas/xtensa/loc.s: New file: loc test.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 gas/config/tc-xtensa.c           |    6 +++---
 gas/testsuite/gas/xtensa/all.exp |    1 +
 gas/testsuite/gas/xtensa/loc.d   |   10 ++++++++++
 gas/testsuite/gas/xtensa/loc.s   |    7 +++++++
 4 files changed, 21 insertions(+), 3 deletions(-)
 create mode 100644 gas/testsuite/gas/xtensa/loc.d
 create mode 100644 gas/testsuite/gas/xtensa/loc.s

--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -5961,15 +5961,15 @@
 	    {
 	    case BFD_RELOC_8:
 	      fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF8;
-	      fixP->fx_signed = 1;
+	      fixP->fx_signed = 0;
 	      break;
 	    case BFD_RELOC_16:
 	      fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF16;
-	      fixP->fx_signed = 1;
+	      fixP->fx_signed = 0;
 	      break;
 	    case BFD_RELOC_32:
 	      fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF32;
-	      fixP->fx_signed = 1;
+	      fixP->fx_signed = 0;
 	      break;
 	    default:
 	      break;
--- a/gas/testsuite/gas/xtensa/all.exp
+++ b/gas/testsuite/gas/xtensa/all.exp
@@ -101,6 +101,7 @@
     run_dump_test "trampoline"
     run_dump_test "first_frag_align"
     run_dump_test "auto-litpools"
+    run_dump_test "loc"
 }
 
 if [info exists errorInfo] then {
--- /dev/null
+++ b/gas/testsuite/gas/xtensa/loc.d
@@ -0,0 +1,10 @@
+#as:
+#objdump: -r
+#name: .loc directive relocs
+
+.*: +file format .*xtensa.*
+
+RELOCATION RECORDS FOR \[\.debug_line\]:
+#...
+.*R_XTENSA_DIFF16.*\.text\+0x00009c42
+#...
--- /dev/null
+++ b/gas/testsuite/gas/xtensa/loc.s
@@ -0,0 +1,7 @@
+	.text
+	.file 1 "loc.s"
+	.loc 1 3
+	nop
+	.space 40000
+	.loc 1 5
+	nop