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.
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.
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>
25 Signed-off-by: Romain Naour <romain.naour@gmail.com>
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)
42 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF8;
43 - fixP->fx_signed = 1;
44 + fixP->fx_signed = 0;
47 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF16;
48 - fixP->fx_signed = 1;
49 + fixP->fx_signed = 0;
52 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF32;
53 - fixP->fx_signed = 1;
54 + fixP->fx_signed = 0;
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"
69 if [info exists errorInfo] then {
70 diff --git a/gas/testsuite/gas/xtensa/loc.d b/gas/testsuite/gas/xtensa/loc.d
72 index 0000000..71983cc
74 +++ b/gas/testsuite/gas/xtensa/loc.d
78 +#name: .loc directive relocs
80 +.*: +file format .*xtensa.*
82 +RELOCATION RECORDS FOR \[\.debug_line\]:
84 +.*R_XTENSA_DIFF16.*\.text\+0x00009c42
86 diff --git a/gas/testsuite/gas/xtensa/loc.s b/gas/testsuite/gas/xtensa/loc.s
88 index 0000000..029e14e
90 +++ b/gas/testsuite/gas/xtensa/loc.s