Roland McGrath <mcgrathr@google.com>
authorRoland McGrath <mcgrathr@google.com>
Mon, 11 Jun 2012 20:42:20 +0000 (20:42 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 11 Jun 2012 20:42:20 +0000 (13:42 -0700)
* dwarf2out.c (const_ok_for_output_1): Detect a TLS UNSPEC using
SYMBOL_REF_TLS_MODEL rather than DECL_THREAD_LOCAL_P, in case it's
not a VAR_DECL.  Also don't limit it to UNSPECs with exactly one
operand.

From-SVN: r188398

gcc/ChangeLog
gcc/dwarf2out.c

index 8c3a6bf882c929b6541bc08fd7c6d241164feb0c..bf972d0614c8ac167fd49e4603c1d4f20f5a251b 100644 (file)
@@ -1,3 +1,10 @@
+2012-06-11  Roland McGrath  <mcgrathr@google.com>
+
+       * dwarf2out.c (const_ok_for_output_1): Detect a TLS UNSPEC using
+       SYMBOL_REF_TLS_MODEL rather than DECL_THREAD_LOCAL_P, in case it's
+       not a VAR_DECL.  Also don't limit it to UNSPECs with exactly one
+       operand.
+
 2012-06-11  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/53511
index 6e4ab761b758f3c926fac25b042897fb8367a9d2..3fd51fdb3b82f5cacafefc2270eda9e2c7c6d387 100644 (file)
@@ -10129,12 +10129,12 @@ const_ok_for_output_1 (rtx *rtlp, void *data ATTRIBUTE_UNUSED)
         we can't express it in the debug info.  */
 #ifdef ENABLE_CHECKING
       /* Don't complain about TLS UNSPECs, those are just too hard to
-        delegitimize.  */
-      if (XVECLEN (rtl, 0) != 1
+        delegitimize.  Note this could be a non-decl SYMBOL_REF such as
+        one in a constant pool entry, so testing SYMBOL_REF_TLS_MODEL
+        rather than DECL_THREAD_LOCAL_P is not just an optimization.  */
+      if (XVECLEN (rtl, 0) == 0
          || GET_CODE (XVECEXP (rtl, 0, 0)) != SYMBOL_REF
-         || SYMBOL_REF_DECL (XVECEXP (rtl, 0, 0)) == NULL
-         || TREE_CODE (SYMBOL_REF_DECL (XVECEXP (rtl, 0, 0))) != VAR_DECL
-         || !DECL_THREAD_LOCAL_P (SYMBOL_REF_DECL (XVECEXP (rtl, 0, 0))))
+         || SYMBOL_REF_TLS_MODEL (XVECEXP (rtl, 0, 0)) == TLS_MODEL_NONE)
        inform (current_function_decl
                ? DECL_SOURCE_LOCATION (current_function_decl)
                : UNKNOWN_LOCATION,