board/csky: fixup gdb instructions in readme.txt
[buildroot-gz.git] / package / binutils / 2.26.1 / 0902-xtensa-fix-signedness-of-gas-relocations.patch
blob4ba2f75cc85a395e3936796eff4cda7f847cee8e
1 From eb3e02b484ff75f4a2f54192422a88baa275bdfc Mon Sep 17 00:00:00 2001
2 From: Max Filippov <jcmvbkbc@gmail.com>
3 Date: Tue, 2 Feb 2016 17:11:38 +0300
4 Subject: [PATCH] xtensa: fix signedness of gas relocations
6 Change 1058c7532d0b "Use signed data type for R_XTENSA_DIFF* relocation
7 offsets." changed signedness of BFD_RELOC_XTENSA_DIFF* relocations
8 substituted for BFD_RELOC_*. This made it impossible to encode arbitrary
9 8-, 16- and 32-bit values, which broke e.g. debug info encoding by .loc
10 directive. Revert this part and add test.
12 gas/
13 2016-02-03 Max Filippov <jcmvbkbc@gmail.com>
14 * config/tc-xtensa.c (md_apply_fix): Mark BFD_RELOC_XTENSA_DIFF*
15 substitutions for BFD_RELOC_* as unsigned.
17 gas/testsuite/
18 2016-02-03 Max Filippov <jcmvbkbc@gmail.com>
19 * gas/xtensa/all.exp: Add loc to list of xtensa tests.
20 * gas/xtensa/loc.d: New file: loc test result patterns.
21 * gas/xtensa/loc.s: New file: loc test.
23 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
24 [Rebase on 2.26]
25 Signed-off-by: Romain Naour <romain.naour@gmail.com>
26 ---
27 gas/config/tc-xtensa.c | 6 +++---
28 gas/testsuite/gas/xtensa/all.exp | 1 +
29 gas/testsuite/gas/xtensa/loc.d | 10 ++++++++++
30 gas/testsuite/gas/xtensa/loc.s | 7 +++++++
31 4 files changed, 21 insertions(+), 3 deletions(-)
32 create mode 100644 gas/testsuite/gas/xtensa/loc.d
33 create mode 100644 gas/testsuite/gas/xtensa/loc.s
35 diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
36 index d707da8..f623add 100644
37 --- a/gas/config/tc-xtensa.c
38 +++ b/gas/config/tc-xtensa.c
39 @@ -5961,15 +5961,15 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
41 case BFD_RELOC_8:
42 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF8;
43 - fixP->fx_signed = 1;
44 + fixP->fx_signed = 0;
45 break;
46 case BFD_RELOC_16:
47 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF16;
48 - fixP->fx_signed = 1;
49 + fixP->fx_signed = 0;
50 break;
51 case BFD_RELOC_32:
52 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF32;
53 - fixP->fx_signed = 1;
54 + fixP->fx_signed = 0;
55 break;
56 default:
57 break;
58 diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp
59 index db39629..4daeff2 100644
60 --- a/gas/testsuite/gas/xtensa/all.exp
61 +++ b/gas/testsuite/gas/xtensa/all.exp
62 @@ -101,6 +101,7 @@ if [istarget xtensa*-*-*] then {
63 run_dump_test "trampoline"
64 run_dump_test "first_frag_align"
65 run_dump_test "auto-litpools"
66 + run_dump_test "loc"
69 if [info exists errorInfo] then {
70 diff --git a/gas/testsuite/gas/xtensa/loc.d b/gas/testsuite/gas/xtensa/loc.d
71 new file mode 100644
72 index 0000000..71983cc
73 --- /dev/null
74 +++ b/gas/testsuite/gas/xtensa/loc.d
75 @@ -0,0 +1,10 @@
76 +#as:
77 +#objdump: -r
78 +#name: .loc directive relocs
80 +.*: +file format .*xtensa.*
82 +RELOCATION RECORDS FOR \[\.debug_line\]:
83 +#...
84 +.*R_XTENSA_DIFF16.*\.text\+0x00009c42
85 +#...
86 diff --git a/gas/testsuite/gas/xtensa/loc.s b/gas/testsuite/gas/xtensa/loc.s
87 new file mode 100644
88 index 0000000..029e14e
89 --- /dev/null
90 +++ b/gas/testsuite/gas/xtensa/loc.s
91 @@ -0,0 +1,7 @@
92 + .text
93 + .file 1 "loc.s"
94 + .loc 1 3
95 + nop
96 + .space 40000
97 + .loc 1 5
98 + nop
99 --
100 2.4.3