diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2019-02-11 21:57:23 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2019-02-11 21:57:23 +0000 |
commit | 770623b579388a4f62b15071f778d387a7446f32 (patch) | |
tree | fb3dfef09f579ad7d7aa5dca49f57c683b9c7660 /8.2.0 | |
parent | 8.2.0: don't enable -fstack-clach-protection by default (diff) | |
download | gcc-patches-770623b579388a4f62b15071f778d387a7446f32.tar.gz gcc-patches-770623b579388a4f62b15071f778d387a7446f32.tar.bz2 gcc-patches-770623b579388a4f62b15071f778d387a7446f32.zip |
8.2.0: lto: fix target-specific option leak into global constructors
Picked upstream patch as-is:
https://github.com/gcc-mirror/gcc/commit/332446ac24e5b37f441f7c9cb0b97fc36f9f0aa3
Bug: https://bugs.gentoo.org/677724
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to '8.2.0')
-rw-r--r-- | 8.2.0/gentoo/117_all_lto-ctor-dtor-target.patch | 64 | ||||
-rw-r--r-- | 8.2.0/gentoo/README.history | 1 |
2 files changed, 65 insertions, 0 deletions
diff --git a/8.2.0/gentoo/117_all_lto-ctor-dtor-target.patch b/8.2.0/gentoo/117_all_lto-ctor-dtor-target.patch new file mode 100644 index 0000000..206daae --- /dev/null +++ b/8.2.0/gentoo/117_all_lto-ctor-dtor-target.patch @@ -0,0 +1,64 @@ +https://bugs.gentoo.org/677724 + +Apply file-specific target-specific optimisation to constructors and +destructors. Fixes leaking of target-specific options from one unit +to another. On firefox this change fixes -mavx2 leak from files guarded +by CPU flag detection into other files. + +From 332446ac24e5b37f441f7c9cb0b97fc36f9f0aa3 Mon Sep 17 00:00:00 2001 +From: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> +Date: Sat, 15 Dec 2018 10:31:37 +0000 +Subject: [PATCH] * ipa.c (cgraph_build_static_cdtor_1): Add + OPTIMIZATION and TARGET parameters. (cgraph_build_static_cdtor): + Update. (build_cdtor): Use OPTIMIZATION and TARGET of the first real + cdtor callsed. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267168 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + gcc/ipa.c | 12 +++++++++--- + +--- a/gcc/ipa.c ++++ b/gcc/ipa.c +@@ -831,7 +831,9 @@ ipa_discover_variable_flags (void) + be produced. */ + + static void +-cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final) ++cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final, ++ tree optimization, ++ tree target) + { + static int counter = 0; + char which_buf[16]; +@@ -862,6 +864,8 @@ cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final) + + TREE_STATIC (decl) = 1; + TREE_USED (decl) = 1; ++ DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) = optimization; ++ DECL_FUNCTION_SPECIFIC_TARGET (decl) = target; + DECL_ARTIFICIAL (decl) = 1; + DECL_IGNORED_P (decl) = 1; + DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl) = 1; +@@ -911,7 +915,7 @@ cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final) + void + cgraph_build_static_cdtor (char which, tree body, int priority) + { +- cgraph_build_static_cdtor_1 (which, body, priority, false); ++ cgraph_build_static_cdtor_1 (which, body, priority, false, NULL, NULL); + } + + /* When target does not have ctors and dtors, we call all constructor +@@ -993,7 +997,9 @@ build_cdtor (bool ctor_p, const vec<tree> &cdtors) + gcc_assert (body != NULL_TREE); + /* Generate a function to call all the function of like + priority. */ +- cgraph_build_static_cdtor_1 (ctor_p ? 'I' : 'D', body, priority, true); ++ cgraph_build_static_cdtor_1 (ctor_p ? 'I' : 'D', body, priority, true, ++ DECL_FUNCTION_SPECIFIC_OPTIMIZATION (cdtors[0]), ++ DECL_FUNCTION_SPECIFIC_TARGET (cdtors[0])); + } + } + +-- +2.20.1 + diff --git a/8.2.0/gentoo/README.history b/8.2.0/gentoo/README.history index bf28171..17b6738 100644 --- a/8.2.0/gentoo/README.history +++ b/8.2.0/gentoo/README.history @@ -1,6 +1,7 @@ 1.8 TODO + 116_all_ipa-pgo-PR88561-fix.patch U 55_all_extra-options.patch + + 117_all_lto-ctor-dtor-target.patch 1.7 26 Dec 2018 + 114_all_kr-decl-PR88214.patch |