diff options
author | Joel Stanley <joel@jms.id.au> | 2018-07-30 14:40:29 +0930 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-31 22:55:35 +0100 |
commit | 666e0783525a298217787e3d2f1460c57c2f59ca (patch) | |
tree | 53003fc766a500c637f58dd153a27f0df0a9d541 /meta/recipes-devtools/gcc | |
parent | b1585dde96750c057413564244ac4ed95e8b3d4f (diff) | |
download | poky-666e0783525a298217787e3d2f1460c57c2f59ca.tar.gz |
gcc-7.3: Backport fixes for std::pair high memory usage
C++ applications that contain a specfic use of std::pair with tempates
cause the build to require many gigabytes of RAM to build.
This is a fix that was applied to the upstream GCC 7 branch.
Change-Id: I213f96d1d6332e2dce5765482ff3413f1abd7ff8
(From OE-Core rev: 51a09ba2729a840a9f2f87b68c7f50a3e6ac0d04)
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Ross Burton <ross.burton@intel.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-7.3.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-7.3/0001-PR-c-80290-memory-hog-with-std-pair.patch | 58 |
2 files changed, 59 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-7.3.inc b/meta/recipes-devtools/gcc/gcc-7.3.inc index 81320dc52a..c7c88f12e4 100644 --- a/meta/recipes-devtools/gcc/gcc-7.3.inc +++ b/meta/recipes-devtools/gcc/gcc-7.3.inc | |||
@@ -80,6 +80,7 @@ BACKPORTS = "\ | |||
80 | file://0001-Fix-internal-compiler-error-in-testcase.patch \ | 80 | file://0001-Fix-internal-compiler-error-in-testcase.patch \ |
81 | file://0001-PR-rtl-optimization-83030.patch \ | 81 | file://0001-PR-rtl-optimization-83030.patch \ |
82 | file://0001-Fix-ppc64le-build-Partial-backport-r256656.patch \ | 82 | file://0001-Fix-ppc64le-build-Partial-backport-r256656.patch \ |
83 | file://0001-PR-c-80290-memory-hog-with-std-pair.patch \ | ||
83 | " | 84 | " |
84 | 85 | ||
85 | SRC_URI[md5sum] = "be2da21680f27624f3a87055c4ba5af2" | 86 | SRC_URI[md5sum] = "be2da21680f27624f3a87055c4ba5af2" |
diff --git a/meta/recipes-devtools/gcc/gcc-7.3/0001-PR-c-80290-memory-hog-with-std-pair.patch b/meta/recipes-devtools/gcc/gcc-7.3/0001-PR-c-80290-memory-hog-with-std-pair.patch new file mode 100644 index 0000000000..603a29afec --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-7.3/0001-PR-c-80290-memory-hog-with-std-pair.patch | |||
@@ -0,0 +1,58 @@ | |||
1 | From 8c014bceeca6a558519e86b16a8142accc41e94f Mon Sep 17 00:00:00 2001 | ||
2 | From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Thu, 28 Jun 2018 00:25:21 +0000 | ||
4 | Subject: [PATCH] PR c++/80290 - memory-hog with std::pair. | ||
5 | |||
6 | * pt.c (type_unification_real): Skip non-dependent conversion | ||
7 | check for a nested list argument. | ||
8 | (braced_init_depth): New. | ||
9 | |||
10 | Upstream-Status: Backport | ||
11 | Signed-off-by: Joel Stanley <joel@jms.id.au> | ||
12 | --- | ||
13 | gcc/cp/pt.c | 22 ++++++++++++++++++++++ | ||
14 | 1 file changed, 22 insertions(+) | ||
15 | |||
16 | diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c | ||
17 | index 79cfd0129226..71077a3b0498 100644 | ||
18 | --- a/gcc/cp/pt.c | ||
19 | +++ b/gcc/cp/pt.c | ||
20 | @@ -19242,6 +19242,24 @@ try_array_deduction (tree tparms, tree targs, tree parm) | ||
21 | /*nondeduced*/false, array_deduction_r); | ||
22 | } | ||
23 | |||
24 | +/* Returns how many levels of { } INIT contains. */ | ||
25 | + | ||
26 | +static int | ||
27 | +braced_init_depth (tree init) | ||
28 | +{ | ||
29 | + if (!init || !BRACE_ENCLOSED_INITIALIZER_P (init)) | ||
30 | + return 0; | ||
31 | + unsigned i; tree val; | ||
32 | + unsigned max = 0; | ||
33 | + FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (init), i, val) | ||
34 | + { | ||
35 | + unsigned elt_d = braced_init_depth (val); | ||
36 | + if (elt_d > max) | ||
37 | + max = elt_d; | ||
38 | + } | ||
39 | + return max + 1; | ||
40 | +} | ||
41 | + | ||
42 | /* Most parms like fn_type_unification. | ||
43 | |||
44 | If SUBR is 1, we're being called recursively (to unify the | ||
45 | @@ -19478,6 +19496,10 @@ type_unification_real (tree tparms, | ||
46 | |||
47 | if (uses_template_parms (parm)) | ||
48 | continue; | ||
49 | + /* Workaround for c++/80290: avoid combinatorial explosion on | ||
50 | + deeply nested braced init-lists. */ | ||
51 | + if (braced_init_depth (arg) > 2) | ||
52 | + continue; | ||
53 | if (check_non_deducible_conversion (parm, arg, strict, flags, | ||
54 | explain_p)) | ||
55 | return 1; | ||
56 | -- | ||
57 | 2.17.1 | ||
58 | |||