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.
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 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)
40 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF8;
41 - fixP->fx_signed = 1;
42 + fixP->fx_signed = 0;
45 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF16;
46 - fixP->fx_signed = 1;
47 + fixP->fx_signed = 0;
50 fixP->fx_r_type = BFD_RELOC_XTENSA_DIFF32;
51 - fixP->fx_signed = 1;
52 + fixP->fx_signed = 0;
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"
67 if [info exists errorInfo] then {
68 diff --git a/gas/testsuite/gas/xtensa/loc.d b/gas/testsuite/gas/xtensa/loc.d
70 index 0000000..71983cc
72 +++ b/gas/testsuite/gas/xtensa/loc.d
76 +#name: .loc directive relocs
78 +.*: +file format .*xtensa.*
80 +RELOCATION RECORDS FOR \[\.debug_line\]:
82 +.*R_XTENSA_DIFF16.*\.text\+0x00009c42
84 diff --git a/gas/testsuite/gas/xtensa/loc.s b/gas/testsuite/gas/xtensa/loc.s
86 index 0000000..029e14e
88 +++ b/gas/testsuite/gas/xtensa/loc.s