#include "debug.h"
#include "function.h"
#include "target.h"
+#include "common/common-target.h"
#include "langhooks.h"
#include "obstack.h"
#include "expr.h"
+#include "cgraph.h"
#ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h"
obstack_free (&stabstr_ob, str);
}
-#if defined (DBX_DEBUGGING_INFO)
+#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
/* When -gused is used, emit debug info for only used symbols. But in
addition to the standard intercepted debug_hooks there are some
#define DBXOUT_DECR_NESTING_AND_RETURN(x) \
do {--debug_nesting; return (x);} while (0)
+#endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
+
+#if defined (DBX_DEBUGGING_INFO)
+
static void
dbxout_function_end (tree decl ATTRIBUTE_UNUSED)
{
named sections. */
if (!use_gnu_debug_info_extensions
|| NO_DBX_FUNCTION_END
- || !targetm.have_named_sections)
+ || !targetm_common.have_named_sections)
return;
/* By convention, GCC will mark the end of a function with an N_FUN
{
/* If one of the nodes is an error_mark or its type is then
return early. */
- if (tem == error_mark_node || TREE_TYPE (tem) == error_mark_node)
+ if (error_operand_p (tem))
return;
/* Omit here local type decls until we know how to support them. */
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: