The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / gcc / 4.7.4 / 843-gcc-4.7.3-Fix-PR-target-58595.patch
1 commit 4fa1f8926227d4e79975b674dc4292b9bec4b137
2 Author: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
3 Date:   Thu Mar 6 12:07:07 2014 +0000
4
5         PR target/58595
6         * config/arm/arm.c (arm_tls_symbol_p): Remove.
7         (arm_legitimize_address): Call legitimize_tls_address for any
8         arm_tls_referenced_p expression, handle constant addend.  Call it
9         before testing for !TARGET_ARM.
10         (thumb_legitimize_address): Don't handle arm_tls_symbol_p here.
11     
12         * gcc.dg/tls/pr58595.c: New test.
13     
14     
15     git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208380 138bc75d-0d04-0410-961f-82ee72b054a4
16
17 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
18 index ce24bfe..af5666b 100644
19 --- a/gcc/config/arm/arm.c
20 +++ b/gcc/config/arm/arm.c
21 @@ -235,7 +235,6 @@ static tree arm_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
22  static void arm_option_override (void);
23  static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
24  static bool arm_cannot_copy_insn_p (rtx);
25 -static bool arm_tls_symbol_p (rtx x);
26  static int arm_issue_rate (void);
27  static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
28  static bool arm_output_addr_const_extra (FILE *, rtx);
29 @@ -7336,6 +7335,32 @@ legitimize_tls_address (rtx x, rtx reg)
30  rtx
31  arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
32  {
33 +  if (arm_tls_referenced_p (x))
34 +    {
35 +      rtx addend = NULL;
36 +
37 +      if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS)
38 +       {
39 +         addend = XEXP (XEXP (x, 0), 1);
40 +         x = XEXP (XEXP (x, 0), 0);
41 +       }
42 +
43 +      if (GET_CODE (x) != SYMBOL_REF)
44 +       return x;
45 +
46 +      gcc_assert (SYMBOL_REF_TLS_MODEL (x) != 0);
47 +
48 +      x = legitimize_tls_address (x, NULL_RTX);
49 +
50 +      if (addend)
51 +       {
52 +         x = gen_rtx_PLUS (SImode, x, addend);
53 +         orig_x = x;
54 +       }
55 +      else
56 +       return x;
57 +    }
58 +
59    if (!TARGET_ARM)
60      {
61        /* TODO: legitimize_address for Thumb2.  */
62 @@ -7344,9 +7369,6 @@ arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
63        return thumb_legitimize_address (x, orig_x, mode);
64      }
65  
66 -  if (arm_tls_symbol_p (x))
67 -    return legitimize_tls_address (x, NULL_RTX);
68 -
69    if (GET_CODE (x) == PLUS)
70      {
71        rtx xop0 = XEXP (x, 0);
72 @@ -7459,9 +7481,6 @@ arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
73  rtx
74  thumb_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
75  {
76 -  if (arm_tls_symbol_p (x))
77 -    return legitimize_tls_address (x, NULL_RTX);
78 -
79    if (GET_CODE (x) == PLUS
80        && CONST_INT_P (XEXP (x, 1))
81        && (INTVAL (XEXP (x, 1)) >= 32 * GET_MODE_SIZE (mode)
82 @@ -7756,20 +7775,6 @@ thumb_legitimize_reload_address (rtx *x_p,
83  
84  /* Test for various thread-local symbols.  */
85  
86 -/* Return TRUE if X is a thread-local symbol.  */
87 -
88 -static bool
89 -arm_tls_symbol_p (rtx x)
90 -{
91 -  if (! TARGET_HAVE_TLS)
92 -    return false;
93 -
94 -  if (GET_CODE (x) != SYMBOL_REF)
95 -    return false;
96 -
97 -  return SYMBOL_REF_TLS_MODEL (x) != 0;
98 -}
99 -
100  /* Helper for arm_tls_referenced_p.  */
101  
102  static int