cannelloni: needs dynamic library
[buildroot-gz.git] / package / gcc / arc-2015.12 / 901-UPDATE1-Fix-handling-complex-PIC-moves.patch
blob28cb7c1913ac5eaf86854bb48aef3481c90b31bb
1 From f00b0f17d6889d811468c2c77508fbea8bfc377d Mon Sep 17 00:00:00 2001
2 From: Claudiu Zissulescu <claziss@synopsys.com>
3 Date: Tue, 19 Jan 2016 14:40:16 +0100
4 Subject: [PATCH] UPDATE1: Fix handling complex PIC moves.
6 The arc_legitimate_pc_offset_p condition is too lax. Updated it.
8 The fix is done in development tree: [arc-4.8-dev f00b0f1]
9 and will be a part of the next release of ARC GNU tools.
10 Once that new release happens this patch must be removed.
12 gcc/
13 2016-01-18 Claudiu Zissulescu <claziss@synopsys.com>
15 * config/arc/arc.c (arc_needs_pcl_p ): New function
16 (arc_legitimate_pc_offset_p): Use arc_needs_pcl_p.
17 ---
18 gcc/config/arc/arc.c | 42 ++++++++++++++++++++++++++++++++++++++++--
19 1 file changed, 40 insertions(+), 2 deletions(-)
21 diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
22 index f7cae9f..18d88a3 100644
23 --- a/gcc/config/arc/arc.c
24 +++ b/gcc/config/arc/arc.c
25 @@ -5234,6 +5234,45 @@ arc_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
29 +/* Helper used by arc_legitimate_pc_offset_p. */
31 +static bool
32 +arc_needs_pcl_p (rtx x)
34 + register const char *fmt;
35 + register int i, j;
37 + if ((GET_CODE (x) == UNSPEC)
38 + && (XVECLEN (x, 0) == 1)
39 + && (GET_CODE (XVECEXP (x, 0, 0)) == SYMBOL_REF))
40 + switch (XINT (x, 1))
41 + {
42 + case ARC_UNSPEC_GOT:
43 + case ARC_UNSPEC_GOTOFFPC:
44 + case UNSPEC_TLS_GD:
45 + case UNSPEC_TLS_IE:
46 + return true;
47 + default:
48 + break;
49 + }
51 + fmt = GET_RTX_FORMAT (GET_CODE (x));
52 + for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
53 + {
54 + if (fmt[i] == 'e')
55 + {
56 + if (arc_needs_pcl_p (XEXP (x, i)))
57 + return true;
58 + }
59 + else if (fmt[i] == 'E')
60 + for (j = XVECLEN (x, i) - 1; j >= 0; j--)
61 + if (arc_needs_pcl_p (XVECEXP (x, i, j)))
62 + return true;
63 + }
65 + return false;
68 /* Return true if ADDR is an address that needs to be expressed as an
69 explicit sum of pcl + offset. */
71 @@ -5242,8 +5281,7 @@ arc_legitimate_pc_offset_p (rtx addr)
73 if (GET_CODE (addr) != CONST)
74 return false;
75 - addr = XEXP (addr, 0);
76 - return flag_pic && !arc_raw_symbolic_reference_mentioned_p (addr, false);
77 + return arc_needs_pcl_p (addr);
80 /* Return true if ADDR is a valid pic address.
81 --
82 2.5.0