diff options
author | Joel Stanley <joel@jms.id.au> | 2018-06-27 08:10:11 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-07-19 02:22:37 +0300 |
commit | 72b02463ccc2131ca8e48f865c60835fd0b65982 (patch) | |
tree | ac105cd2edcd073c7c86d7ee4c91518c69c28dfd /import-layers/yocto-poky/meta/recipes-devtools | |
parent | d1707bf0b879e21e87e27e95b6f0e2d4973ff4b2 (diff) | |
download | openbmc-72b02463ccc2131ca8e48f865c60835fd0b65982.tar.xz |
gcc: Backport fixes for std::pair high memory usage
When building some phosphor packages, a particular use of std::pair with
tempates causes the build to require many gigabytes of RAM to build.
This is a fix that was applied to the upstream GCC 7 branch that should
help reduce the memory usage.
If we ever move to GCC 7.4 this patch can be dropped.
Change-Id: I213f96d1d6332e2dce5765482ff3413f1abd7ff8
Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-devtools')
-rw-r--r-- | import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3.inc | 1 | ||||
-rw-r--r-- | import-layers/yocto-poky/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/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3.inc b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3.inc index d968c322d..8a66e83dd 100644 --- a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3.inc +++ b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3.inc @@ -79,6 +79,7 @@ SRC_URI = "\ BACKPORTS = "\ file://0001-Fix-internal-compiler-error-in-testcase.patch \ file://0001-PR-rtl-optimization-83030.patch \ + file://0001-PR-c-80290-memory-hog-with-std-pair.patch \ " SRC_URI[md5sum] = "be2da21680f27624f3a87055c4ba5af2" diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3/0001-PR-c-80290-memory-hog-with-std-pair.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3/0001-PR-c-80290-memory-hog-with-std-pair.patch new file mode 100644 index 000000000..ba43af92f --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-7.3/0001-PR-c-80290-memory-hog-with-std-pair.patch @@ -0,0 +1,58 @@ +From 8c014bceeca6a558519e86b16a8142accc41e94f Mon Sep 17 00:00:00 2001 +From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> +Date: Thu, 28 Jun 2018 00:25:21 +0000 +Subject: [PATCH] PR c++/80290 - memory-hog with std::pair. + + * pt.c (type_unification_real): Skip non-dependent conversion + check for a nested list argument. + (braced_init_depth): New. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@262204 138bc75d-0d04-0410-961f-82ee72b054a4 +Signed-off-by: Joel Stanley <joel@jms.id.au> +--- + gcc/cp/pt.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c +index 79cfd0129226..71077a3b0498 100644 +--- a/gcc/cp/pt.c ++++ b/gcc/cp/pt.c +@@ -19242,6 +19242,24 @@ try_array_deduction (tree tparms, tree targs, tree parm) + /*nondeduced*/false, array_deduction_r); + } + ++/* Returns how many levels of { } INIT contains. */ ++ ++static int ++braced_init_depth (tree init) ++{ ++ if (!init || !BRACE_ENCLOSED_INITIALIZER_P (init)) ++ return 0; ++ unsigned i; tree val; ++ unsigned max = 0; ++ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (init), i, val) ++ { ++ unsigned elt_d = braced_init_depth (val); ++ if (elt_d > max) ++ max = elt_d; ++ } ++ return max + 1; ++} ++ + /* Most parms like fn_type_unification. + + If SUBR is 1, we're being called recursively (to unify the +@@ -19478,6 +19496,10 @@ type_unification_real (tree tparms, + + if (uses_template_parms (parm)) + continue; ++ /* Workaround for c++/80290: avoid combinatorial explosion on ++ deeply nested braced init-lists. */ ++ if (braced_init_depth (arg) > 2) ++ continue; + if (check_non_deducible_conversion (parm, arg, strict, flags, + explain_p)) + return 1; +-- +2.17.1 + |