summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0313-PR-debug-49032.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0313-PR-debug-49032.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0313-PR-debug-49032.patch90
1 files changed, 90 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0313-PR-debug-49032.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0313-PR-debug-49032.patch
new file mode 100644
index 0000000000..6400d8749c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0313-PR-debug-49032.patch
@@ -0,0 +1,90 @@
1From 62593aed2e6b228ae5b85fb9721b45cc92cce894 Mon Sep 17 00:00:00 2001
2From: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Mon, 23 May 2011 18:12:34 +0000
4Subject: [PATCH] PR debug/49032
5 * dbxout.c: Include cgraph.h.
6 (dbxout_expand_expr): If a VAR_DECL is TREE_STATIC, not written
7 and without value expr, return NULL if no varpool node exists for
8 it or if it is not needed.
9 * Makefile.in (dbxout.o): Depend on $(CGRAPH_H).
10
11 * gcc.dg/debug/pr49032.c: New test.
12
13
14git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174084 138bc75d-0d04-0410-961f-82ee72b054a4
15
16index 792ca6c..60dcee5 100644
17--- a/gcc/Makefile.in
18+++ b/gcc/Makefile.in
19@@ -2921,7 +2921,8 @@ optabs.o : optabs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
20 dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
21 $(RTL_H) $(FLAGS_H) $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) $(FUNCTION_H) \
22 langhooks.h insn-config.h reload.h $(GSTAB_H) xcoffout.h output.h dbxout.h \
23- toplev.h $(DIAGNOSTIC_CORE_H) $(GGC_H) $(OBSTACK_H) $(EXPR_H) gt-dbxout.h
24+ toplev.h $(DIAGNOSTIC_CORE_H) $(GGC_H) $(OBSTACK_H) $(EXPR_H) $(CGRAPH_H) \
25+ gt-dbxout.h
26 debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H)
27 sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) debug.h \
28 $(TREE_H) $(GGC_H) $(RTL_H) $(REGS_H) $(FLAGS_H) insn-config.h \
29diff --git a/gcc/dbxout.c b/gcc/dbxout.c
30index 3b0cf34..836030d 100644
31--- a/gcc/dbxout.c
32+++ b/gcc/dbxout.c
33@@ -1,7 +1,7 @@
34 /* Output dbx-format symbol table information from GNU compiler.
35 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
36- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
37- Free Software Foundation, Inc.
38+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
39+ 2011 Free Software Foundation, Inc.
40
41 This file is part of GCC.
42
43@@ -91,6 +91,7 @@ along with GCC; see the file COPYING3. If not see
44 #include "langhooks.h"
45 #include "obstack.h"
46 #include "expr.h"
47+#include "cgraph.h"
48
49 #ifdef XCOFF_DEBUGGING_INFO
50 #include "xcoffout.h"
51@@ -2393,6 +2394,20 @@ dbxout_expand_expr (tree expr)
52 disable debug info for these variables. */
53 if (!targetm.have_tls && DECL_THREAD_LOCAL_P (expr))
54 return NULL;
55+ if (TREE_STATIC (expr)
56+ && !TREE_ASM_WRITTEN (expr)
57+ && !DECL_HAS_VALUE_EXPR_P (expr)
58+ && !TREE_PUBLIC (expr)
59+ && DECL_RTL_SET_P (expr)
60+ && MEM_P (DECL_RTL (expr)))
61+ {
62+ /* If this is a var that might not be actually output,
63+ return NULL, otherwise stabs might reference an undefined
64+ symbol. */
65+ struct varpool_node *node = varpool_get_node (expr);
66+ if (!node || !node->needed)
67+ return NULL;
68+ }
69 /* FALLTHRU */
70
71 case PARM_DECL:
72new file mode 100644
73index 0000000..3985040
74--- /dev/null
75+++ b/gcc/testsuite/gcc.dg/debug/pr49032.c
76@@ -0,0 +1,11 @@
77+/* PR debug/49032 */
78+/* { dg-do link } */
79+
80+static int s = 42;
81+
82+int
83+main ()
84+{
85+ int *l[18] = { &s, &s, &s, &s, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
86+ return 0;
87+}
88--
891.7.0.4
90