1 |
commit: 770623b579388a4f62b15071f778d387a7446f32 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 11 21:57:23 2019 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 11 21:57:23 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=770623b5 |
7 |
|
8 |
8.2.0: lto: fix target-specific option leak into global constructors |
9 |
|
10 |
Picked upstream patch as-is: |
11 |
https://github.com/gcc-mirror/gcc/commit/332446ac24e5b37f441f7c9cb0b97fc36f9f0aa3 |
12 |
|
13 |
Bug: https://bugs.gentoo.org/677724 |
14 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
15 |
|
16 |
8.2.0/gentoo/117_all_lto-ctor-dtor-target.patch | 64 +++++++++++++++++++++++++ |
17 |
8.2.0/gentoo/README.history | 1 + |
18 |
2 files changed, 65 insertions(+) |
19 |
|
20 |
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 |
21 |
new file mode 100644 |
22 |
index 0000000..206daae |
23 |
--- /dev/null |
24 |
+++ b/8.2.0/gentoo/117_all_lto-ctor-dtor-target.patch |
25 |
@@ -0,0 +1,64 @@ |
26 |
+https://bugs.gentoo.org/677724 |
27 |
+ |
28 |
+Apply file-specific target-specific optimisation to constructors and |
29 |
+destructors. Fixes leaking of target-specific options from one unit |
30 |
+to another. On firefox this change fixes -mavx2 leak from files guarded |
31 |
+by CPU flag detection into other files. |
32 |
+ |
33 |
+From 332446ac24e5b37f441f7c9cb0b97fc36f9f0aa3 Mon Sep 17 00:00:00 2001 |
34 |
+From: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> |
35 |
+Date: Sat, 15 Dec 2018 10:31:37 +0000 |
36 |
+Subject: [PATCH] * ipa.c (cgraph_build_static_cdtor_1): Add |
37 |
+ OPTIMIZATION and TARGET parameters. (cgraph_build_static_cdtor): |
38 |
+ Update. (build_cdtor): Use OPTIMIZATION and TARGET of the first real |
39 |
+ cdtor callsed. |
40 |
+ |
41 |
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267168 138bc75d-0d04-0410-961f-82ee72b054a4 |
42 |
+--- |
43 |
+ gcc/ipa.c | 12 +++++++++--- |
44 |
+ |
45 |
+--- a/gcc/ipa.c |
46 |
++++ b/gcc/ipa.c |
47 |
+@@ -831,7 +831,9 @@ ipa_discover_variable_flags (void) |
48 |
+ be produced. */ |
49 |
+ |
50 |
+ static void |
51 |
+-cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final) |
52 |
++cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final, |
53 |
++ tree optimization, |
54 |
++ tree target) |
55 |
+ { |
56 |
+ static int counter = 0; |
57 |
+ char which_buf[16]; |
58 |
+@@ -862,6 +864,8 @@ cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final) |
59 |
+ |
60 |
+ TREE_STATIC (decl) = 1; |
61 |
+ TREE_USED (decl) = 1; |
62 |
++ DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) = optimization; |
63 |
++ DECL_FUNCTION_SPECIFIC_TARGET (decl) = target; |
64 |
+ DECL_ARTIFICIAL (decl) = 1; |
65 |
+ DECL_IGNORED_P (decl) = 1; |
66 |
+ DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl) = 1; |
67 |
+@@ -911,7 +915,7 @@ cgraph_build_static_cdtor_1 (char which, tree body, int priority, bool final) |
68 |
+ void |
69 |
+ cgraph_build_static_cdtor (char which, tree body, int priority) |
70 |
+ { |
71 |
+- cgraph_build_static_cdtor_1 (which, body, priority, false); |
72 |
++ cgraph_build_static_cdtor_1 (which, body, priority, false, NULL, NULL); |
73 |
+ } |
74 |
+ |
75 |
+ /* When target does not have ctors and dtors, we call all constructor |
76 |
+@@ -993,7 +997,9 @@ build_cdtor (bool ctor_p, const vec<tree> &cdtors) |
77 |
+ gcc_assert (body != NULL_TREE); |
78 |
+ /* Generate a function to call all the function of like |
79 |
+ priority. */ |
80 |
+- cgraph_build_static_cdtor_1 (ctor_p ? 'I' : 'D', body, priority, true); |
81 |
++ cgraph_build_static_cdtor_1 (ctor_p ? 'I' : 'D', body, priority, true, |
82 |
++ DECL_FUNCTION_SPECIFIC_OPTIMIZATION (cdtors[0]), |
83 |
++ DECL_FUNCTION_SPECIFIC_TARGET (cdtors[0])); |
84 |
+ } |
85 |
+ } |
86 |
+ |
87 |
+-- |
88 |
+2.20.1 |
89 |
+ |
90 |
|
91 |
diff --git a/8.2.0/gentoo/README.history b/8.2.0/gentoo/README.history |
92 |
index bf28171..17b6738 100644 |
93 |
--- a/8.2.0/gentoo/README.history |
94 |
+++ b/8.2.0/gentoo/README.history |
95 |
@@ -1,6 +1,7 @@ |
96 |
1.8 TODO |
97 |
+ 116_all_ipa-pgo-PR88561-fix.patch |
98 |
U 55_all_extra-options.patch |
99 |
+ + 117_all_lto-ctor-dtor-target.patch |
100 |
|
101 |
1.7 26 Dec 2018 |
102 |
+ 114_all_kr-decl-PR88214.patch |