summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc
diff options
context:
space:
mode:
authorZhixiong Chi <zhixiong.chi@windriver.com>2019-05-28 00:59:49 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-29 12:54:12 +0100
commit5aa31947956c70585ee35596f0df075789b83ae7 (patch)
tree552f94c1059b7d0885bc3e3373f825c576ba6e29 /meta/recipes-devtools/gcc
parent05eb9a66958bcae3b8519a601a74d23483018357 (diff)
downloadpoky-5aa31947956c70585ee35596f0df075789b83ae7.tar.gz
gcc: reduce the variables in symtab
Backport the patch from upstream: https://github.com/gcc-mirror/gcc.git [commit beb921e] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=269925 Add the premark_used_variables function, meanwhile do not mark not premarked external variables in prune_unused_types_walk. (From OE-Core rev: 5f2119a309096aa8cbae666c37521b0c93da53d0) Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-8.3/0042-PR-debug-86964.patch94
2 files changed, 95 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-8.3.inc b/meta/recipes-devtools/gcc/gcc-8.3.inc
index fe9c7c3602..a6b772aadd 100644
--- a/meta/recipes-devtools/gcc/gcc-8.3.inc
+++ b/meta/recipes-devtools/gcc/gcc-8.3.inc
@@ -72,6 +72,7 @@ SRC_URI = "\
72 file://0039-riscv-Disable-multilib-for-OE.patch \ 72 file://0039-riscv-Disable-multilib-for-OE.patch \
73 file://0040-powerpc-powerpc64-Add-support-for-musl-ldso.patch \ 73 file://0040-powerpc-powerpc64-Add-support-for-musl-ldso.patch \
74 file://0041-Add-a-recursion-limit-to-libiberty-s-demangling-code.patch \ 74 file://0041-Add-a-recursion-limit-to-libiberty-s-demangling-code.patch \
75 file://0042-PR-debug-86964.patch \
75" 76"
76SRC_URI[md5sum] = "65b210b4bfe7e060051f799e0f994896" 77SRC_URI[md5sum] = "65b210b4bfe7e060051f799e0f994896"
77SRC_URI[sha256sum] = "64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c" 78SRC_URI[sha256sum] = "64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c"
diff --git a/meta/recipes-devtools/gcc/gcc-8.3/0042-PR-debug-86964.patch b/meta/recipes-devtools/gcc/gcc-8.3/0042-PR-debug-86964.patch
new file mode 100644
index 0000000000..d9b5d39b77
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-8.3/0042-PR-debug-86964.patch
@@ -0,0 +1,94 @@
1From beb921e1106b5bcbb0c6e2be84b241327e2ffc51 Mon Sep 17 00:00:00 2001
2From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Mon, 25 Mar 2019 21:19:09 +0000
4Subject: [PATCH] PR debug/86964 * dwarf2out.c
5 (premark_used_variables): New function. (prune_unused_types_walk): Do
6 not mark not premarked external variables. (prune_unused_types):
7 Call premark_used_variables.
8
9 * gcc.dg/debug/dwarf2/pr86964.c: New testcase.
10
11git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269925 138bc75d-0d04-0410-961f-82ee72b054a4
12
13Upstream-Status: Backport
14Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
15---
16 gcc/ChangeLog | 8 ++++++
17 gcc/dwarf2out.c | 32 +++++++++++++++++++++
18 2 files changed, 40 insertions(+)
19
20diff --git a/gcc/ChangeLog b/gcc/ChangeLog
21index 2075480ca2b..cdce539ac6f 100644
22--- a/gcc/ChangeLog
23+++ b/gcc/ChangeLog
24@@ -1,3 +1,11 @@
25+2019-03-25 Johan Karlsson <johan.karlsson@enea.com>
26+
27+ PR debug/86964
28+ * dwarf2out.c (premark_used_variables): New function.
29+ (prune_unused_types_walk): Do not mark not premarked external
30+ variables.
31+ (prune_unused_types): Call premark_used_variables.
32+
33 2019-02-22 Release Manager
34
35 * GCC 8.3.0 released.
36diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
37index ae8bdee9981..b9a624e1ac7 100644
38--- a/gcc/dwarf2out.c
39+++ b/gcc/dwarf2out.c
40@@ -22658,6 +22658,21 @@ premark_types_used_by_global_vars (void)
41 ->traverse<void *, premark_types_used_by_global_vars_helper> (NULL);
42 }
43
44+/* Mark all variables used by the symtab as perennial. */
45+
46+static void
47+premark_used_variables (void)
48+{
49+ /* Mark DIEs in the symtab as used. */
50+ varpool_node *var;
51+ FOR_EACH_VARIABLE (var)
52+ {
53+ dw_die_ref die = lookup_decl_die (var->decl);
54+ if (die)
55+ die->die_perennial_p = 1;
56+ }
57+}
58+
59 /* Generate a DW_TAG_call_site DIE in function DECL under SUBR_DIE
60 for CA_LOC call arg loc node. */
61
62@@ -29264,6 +29279,19 @@ prune_unused_types_walk (dw_die_ref die)
63
64 return;
65
66+ case DW_TAG_variable:
67+ if (flag_debug_only_used_symbols)
68+ {
69+ if (die->die_perennial_p)
70+ break;
71+
72+ /* premark_used_variables marks external variables --- don't mark
73+ them here. */
74+ if (get_AT (die, DW_AT_external))
75+ return;
76+ }
77+ /* FALLTHROUGH */
78+
79 default:
80 /* Mark everything else. */
81 break;
82@@ -29390,6 +29418,10 @@ prune_unused_types (void)
83 /* Mark types that are used in global variables. */
84 premark_types_used_by_global_vars ();
85
86+ /* Mark variables used in the symtab. */
87+ if (flag_debug_only_used_symbols)
88+ premark_used_variables ();
89+
90 /* Set the mark on nodes that are actually used. */
91 prune_unused_types_walk (comp_unit_die ());
92 for (node = limbo_die_list; node; node = node->next)
93--
942.21.0