OSDN Git Service

- fix whitespace in laste gcc/ChangeLog entry
[pf3gnuchains/gcc-fork.git] / gcc / dbxout.c
index 0b4c050..836030d 100644 (file)
@@ -1,7 +1,7 @@
 /* Output dbx-format symbol table information from GNU compiler.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+   2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -91,6 +91,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "langhooks.h"
 #include "obstack.h"
 #include "expr.h"
+#include "cgraph.h"
 
 #ifdef XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"
@@ -384,7 +385,8 @@ const struct gcc_debug_hooks dbx_debug_hooks =
   debug_nothing_rtx_rtx,                /* copy_call_info */
   debug_nothing_uid,                    /* virtual_call */
   debug_nothing_tree_tree,              /* set_name */
-  0                                      /* start_end_main_source_file */
+  0,                                     /* start_end_main_source_file */
+  TYPE_SYMTAB_IS_ADDRESS                 /* tree_type_symtab_field */
 };
 #endif /* DBX_DEBUGGING_INFO  */
 
@@ -423,7 +425,8 @@ const struct gcc_debug_hooks xcoff_debug_hooks =
   debug_nothing_rtx_rtx,                /* copy_call_info */
   debug_nothing_uid,                    /* virtual_call */
   debug_nothing_tree_tree,              /* set_name */
-  0                                      /* start_end_main_source_file */
+  0,                                     /* start_end_main_source_file */
+  TYPE_SYMTAB_IS_ADDRESS                 /* tree_type_symtab_field */
 };
 #endif /* XCOFF_DEBUGGING_INFO  */
 \f
@@ -1863,6 +1866,7 @@ dbxout_type (tree type, int full)
   switch (TREE_CODE (type))
     {
     case VOID_TYPE:
+    case NULLPTR_TYPE:
     case LANG_TYPE:
       /* For a void type, just define it as itself; i.e., "5=5".
         This makes us consider it defined
@@ -2390,15 +2394,29 @@ dbxout_expand_expr (tree expr)
         disable debug info for these variables.  */
       if (!targetm.have_tls && DECL_THREAD_LOCAL_P (expr))
        return NULL;
+      if (TREE_STATIC (expr)
+         && !TREE_ASM_WRITTEN (expr)
+         && !DECL_HAS_VALUE_EXPR_P (expr)
+         && !TREE_PUBLIC (expr)
+         && DECL_RTL_SET_P (expr)
+         && MEM_P (DECL_RTL (expr)))
+       {
+         /* If this is a var that might not be actually output,
+            return NULL, otherwise stabs might reference an undefined
+            symbol.  */
+         struct varpool_node *node = varpool_get_node (expr);
+         if (!node || !node->needed)
+           return NULL;
+       }
       /* FALLTHRU */
 
     case PARM_DECL:
+    case RESULT_DECL:
       if (DECL_HAS_VALUE_EXPR_P (expr))
        return dbxout_expand_expr (DECL_VALUE_EXPR (expr));
       /* FALLTHRU */
 
     case CONST_DECL:
-    case RESULT_DECL:
       return DECL_RTL_IF_SET (expr);
 
     case INTEGER_CST:
@@ -2505,8 +2523,7 @@ output_used_types (void)
       htab_traverse (cfun->used_types_hash, output_used_types_helper, &types);
 
       /* Sort by UID to prevent dependence on hash table ordering.  */
-      qsort (VEC_address (tree, types), VEC_length (tree, types),
-            sizeof (tree), output_types_sort);
+      VEC_qsort (tree, types, output_types_sort);
 
       FOR_EACH_VEC_ELT (tree, types, i, type)
        debug_queue_symbol (type);
@@ -2822,7 +2839,7 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
          && DECL_INITIAL (decl) != 0
          && host_integerp (DECL_INITIAL (decl), 0)
          && ! TREE_ASM_WRITTEN (decl)
-         && (DECL_CONTEXT (decl) == NULL_TREE
+         && (DECL_FILE_SCOPE_P (decl)
              || TREE_CODE (DECL_CONTEXT (decl)) == BLOCK
              || TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL)
          && TREE_PUBLIC (decl) == 0)
@@ -3015,7 +3032,7 @@ dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home)
               || (REG_P (XEXP (home, 0))
                   && REGNO (XEXP (home, 0)) != HARD_FRAME_POINTER_REGNUM
                   && REGNO (XEXP (home, 0)) != STACK_POINTER_REGNUM
-#if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
+#if !HARD_FRAME_POINTER_IS_ARG_POINTER
                   && REGNO (XEXP (home, 0)) != ARG_POINTER_REGNUM
 #endif
                   )))
@@ -3429,7 +3446,7 @@ dbxout_parms (tree parms)
                 && REG_P (XEXP (DECL_RTL (parms), 0))
                 && REGNO (XEXP (DECL_RTL (parms), 0)) != HARD_FRAME_POINTER_REGNUM
                 && REGNO (XEXP (DECL_RTL (parms), 0)) != STACK_POINTER_REGNUM
-#if ARG_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
+#if !HARD_FRAME_POINTER_IS_ARG_POINTER
                 && REGNO (XEXP (DECL_RTL (parms), 0)) != ARG_POINTER_REGNUM
 #endif
                 )