patches/gcc/4.7.3/100-fix-PR-target-58595.patch
changeset 3294 c65fcf8a34b7
child 3295 db3f7ffabdc8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gcc/4.7.3/100-fix-PR-target-58595.patch	Thu Apr 17 18:17:12 2014 +0200
     1.3 @@ -0,0 +1,102 @@
     1.4 +commit 4fa1f8926227d4e79975b674dc4292b9bec4b137
     1.5 +Author: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
     1.6 +Date:   Thu Mar 6 12:07:07 2014 +0000
     1.7 +
     1.8 +    	PR target/58595
     1.9 +    	* config/arm/arm.c (arm_tls_symbol_p): Remove.
    1.10 +    	(arm_legitimize_address): Call legitimize_tls_address for any
    1.11 +    	arm_tls_referenced_p expression, handle constant addend.  Call it
    1.12 +    	before testing for !TARGET_ARM.
    1.13 +    	(thumb_legitimize_address): Don't handle arm_tls_symbol_p here.
    1.14 +    
    1.15 +    	* gcc.dg/tls/pr58595.c: New test.
    1.16 +    
    1.17 +    
    1.18 +    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208380 138bc75d-0d04-0410-961f-82ee72b054a4
    1.19 +
    1.20 +diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
    1.21 +index ce24bfe..af5666b 100644
    1.22 +--- a/gcc/config/arm/arm.c
    1.23 ++++ b/gcc/config/arm/arm.c
    1.24 +@@ -235,7 +235,6 @@ static tree arm_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
    1.25 + static void arm_option_override (void);
    1.26 + static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode);
    1.27 + static bool arm_cannot_copy_insn_p (rtx);
    1.28 +-static bool arm_tls_symbol_p (rtx x);
    1.29 + static int arm_issue_rate (void);
    1.30 + static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
    1.31 + static bool arm_output_addr_const_extra (FILE *, rtx);
    1.32 +@@ -7336,6 +7335,32 @@ legitimize_tls_address (rtx x, rtx reg)
    1.33 + rtx
    1.34 + arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
    1.35 + {
    1.36 ++  if (arm_tls_referenced_p (x))
    1.37 ++    {
    1.38 ++      rtx addend = NULL;
    1.39 ++
    1.40 ++      if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS)
    1.41 ++	{
    1.42 ++	  addend = XEXP (XEXP (x, 0), 1);
    1.43 ++	  x = XEXP (XEXP (x, 0), 0);
    1.44 ++	}
    1.45 ++
    1.46 ++      if (GET_CODE (x) != SYMBOL_REF)
    1.47 ++	return x;
    1.48 ++
    1.49 ++      gcc_assert (SYMBOL_REF_TLS_MODEL (x) != 0);
    1.50 ++
    1.51 ++      x = legitimize_tls_address (x, NULL_RTX);
    1.52 ++
    1.53 ++      if (addend)
    1.54 ++	{
    1.55 ++	  x = gen_rtx_PLUS (SImode, x, addend);
    1.56 ++	  orig_x = x;
    1.57 ++	}
    1.58 ++      else
    1.59 ++	return x;
    1.60 ++    }
    1.61 ++
    1.62 +   if (!TARGET_ARM)
    1.63 +     {
    1.64 +       /* TODO: legitimize_address for Thumb2.  */
    1.65 +@@ -7344,9 +7369,6 @@ arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
    1.66 +       return thumb_legitimize_address (x, orig_x, mode);
    1.67 +     }
    1.68 + 
    1.69 +-  if (arm_tls_symbol_p (x))
    1.70 +-    return legitimize_tls_address (x, NULL_RTX);
    1.71 +-
    1.72 +   if (GET_CODE (x) == PLUS)
    1.73 +     {
    1.74 +       rtx xop0 = XEXP (x, 0);
    1.75 +@@ -7459,9 +7481,6 @@ arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
    1.76 + rtx
    1.77 + thumb_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
    1.78 + {
    1.79 +-  if (arm_tls_symbol_p (x))
    1.80 +-    return legitimize_tls_address (x, NULL_RTX);
    1.81 +-
    1.82 +   if (GET_CODE (x) == PLUS
    1.83 +       && CONST_INT_P (XEXP (x, 1))
    1.84 +       && (INTVAL (XEXP (x, 1)) >= 32 * GET_MODE_SIZE (mode)
    1.85 +@@ -7756,20 +7775,6 @@ thumb_legitimize_reload_address (rtx *x_p,
    1.86 + 
    1.87 + /* Test for various thread-local symbols.  */
    1.88 + 
    1.89 +-/* Return TRUE if X is a thread-local symbol.  */
    1.90 +-
    1.91 +-static bool
    1.92 +-arm_tls_symbol_p (rtx x)
    1.93 +-{
    1.94 +-  if (! TARGET_HAVE_TLS)
    1.95 +-    return false;
    1.96 +-
    1.97 +-  if (GET_CODE (x) != SYMBOL_REF)
    1.98 +-    return false;
    1.99 +-
   1.100 +-  return SYMBOL_REF_TLS_MODEL (x) != 0;
   1.101 +-}
   1.102 +-
   1.103 + /* Helper for arm_tls_referenced_p.  */
   1.104 + 
   1.105 + static int