package/rpcbind: fix musl build
[buildroot-gz.git] / package / binutils / 2.25.1 / 914-xtensa-fix-signedness-of-gas-relocations.patch
blobbd751661b83aef74df63bddbc4a12eec8605cd95
1 From 6c7c5c477ef9ccf2d2548cf2ac3cec9bd3c9c5b6 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 ---
25 gas/config/tc-xtensa.c | 6 +++---
26 gas/testsuite/gas/xtensa/all.exp | 1 +
27 gas/testsuite/gas/xtensa/loc.d | 10 ++++++++++
28 gas/testsuite/gas/xtensa/loc.s | 7 +++++++
29 4 files changed, 21 insertions(+), 3 deletions(-)
30 create mode 100644 gas/testsuite/gas/xtensa/loc.d
31 create mode 100644 gas/testsuite/gas/xtensa/loc.s
33 diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
34 index a119871..36a06cc 100644
35 --- a/gas/config/tc-xtensa.c
36 +++ b/gas/config/tc-xtensa.c
37 @@ -5961,15 +5961,15 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
39 case BFD_RELOC_8:
40 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF8;
41 - fixP->fx_signed = 1;
42 + fixP->fx_signed = 0;
43 break;
44 case BFD_RELOC_16:
45 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF16;
46 - fixP->fx_signed = 1;
47 + fixP->fx_signed = 0;
48 break;
49 case BFD_RELOC_32:
50 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF32;
51 - fixP->fx_signed = 1;
52 + fixP->fx_signed = 0;
53 break;
54 default:
55 break;
56 diff --git a/gas/testsuite/gas/xtensa/all.exp b/gas/testsuite/gas/xtensa/all.exp
57 index 31b725b..7ff7bd7 100644
58 --- a/gas/testsuite/gas/xtensa/all.exp
59 +++ b/gas/testsuite/gas/xtensa/all.exp
60 @@ -101,6 +101,7 @@ if [istarget xtensa*-*-*] then {
61 run_dump_test "trampoline"
62 run_dump_test "first_frag_align"
63 run_dump_test "auto-litpools"
64 + run_dump_test "loc"
67 if [info exists errorInfo] then {
68 diff --git a/gas/testsuite/gas/xtensa/loc.d b/gas/testsuite/gas/xtensa/loc.d
69 new file mode 100644
70 index 0000000..71983cc
71 --- /dev/null
72 +++ b/gas/testsuite/gas/xtensa/loc.d
73 @@ -0,0 +1,10 @@
74 +#as:
75 +#objdump: -r
76 +#name: .loc directive relocs
78 +.*: +file format .*xtensa.*
80 +RELOCATION RECORDS FOR \[\.debug_line\]:
81 +#...
82 +.*R_XTENSA_DIFF16.*\.text\+0x00009c42
83 +#...
84 diff --git a/gas/testsuite/gas/xtensa/loc.s b/gas/testsuite/gas/xtensa/loc.s
85 new file mode 100644
86 index 0000000..029e14e
87 --- /dev/null
88 +++ b/gas/testsuite/gas/xtensa/loc.s
89 @@ -0,0 +1,7 @@
90 + .text
91 + .file 1 "loc.s"
92 + .loc 1 3
93 + nop
94 + .space 40000
95 + .loc 1 5
96 + nop
97 --
98 2.1.4