1 |
commit: cb65e6066a41df243404a5fa57079315641c156c |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jun 29 17:43:25 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jun 29 17:43:25 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=cb65e606 |
7 |
|
8 |
Update gcc optimization patch for gcc v9.1+ |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
5012_enable-cpu-optimizations-for-gcc91.patch | 49 ++++++++++++++++----------- |
13 |
1 file changed, 29 insertions(+), 20 deletions(-) |
14 |
|
15 |
diff --git a/5012_enable-cpu-optimizations-for-gcc91.patch b/5012_enable-cpu-optimizations-for-gcc91.patch |
16 |
index dffd36d..8f35520 100644 |
17 |
--- a/5012_enable-cpu-optimizations-for-gcc91.patch |
18 |
+++ b/5012_enable-cpu-optimizations-for-gcc91.patch |
19 |
@@ -42,14 +42,18 @@ It also offers to compile passing the 'native' option which, "selects the CPU |
20 |
to generate code for at compilation time by determining the processor type of |
21 |
the compiling machine. Using -march=native enables all instruction subsets |
22 |
supported by the local machine and will produce code optimized for the local |
23 |
-machine under the constraints of the selected instruction set."[3] |
24 |
+machine under the constraints of the selected instruction set."[2] |
25 |
+ |
26 |
+Do NOT try using the 'native' option on AMD Piledriver, Steamroller, or |
27 |
+Excavator CPUs (-march=bdver{2,3,4} flag). The build will error out due the |
28 |
+kernel's objtool issue with these.[3a,b] |
29 |
|
30 |
MINOR NOTES |
31 |
This patch also changes 'atom' to 'bonnell' in accordance with the gcc v4.9 |
32 |
changes. Note that upstream is using the deprecated 'match=atom' flags when I |
33 |
-believe it should use the newer 'march=bonnell' flag for atom processors.[2] |
34 |
+believe it should use the newer 'march=bonnell' flag for atom processors.[4] |
35 |
|
36 |
-It is not recommended to compile on Atom-CPUs with the 'native' option.[4] The |
37 |
+It is not recommended to compile on Atom-CPUs with the 'native' option.[5] The |
38 |
recommendation is to use the 'atom' option instead. |
39 |
|
40 |
BENEFITS |
41 |
@@ -61,20 +65,22 @@ https://github.com/graysky2/kernel_gcc_patch |
42 |
|
43 |
REQUIREMENTS |
44 |
linux version >=4.13 |
45 |
-gcc version >=9.1 |
46 |
+gcc version >=9.1 and <10 |
47 |
|
48 |
ACKNOWLEDGMENTS |
49 |
-This patch builds on the seminal work by Jeroen.[5] |
50 |
+This patch builds on the seminal work by Jeroen.[6] |
51 |
|
52 |
REFERENCES |
53 |
-1. https://gcc.gnu.org/gcc-4.9/changes.html |
54 |
-2. https://bugzilla.kernel.org/show_bug.cgi?id=77461 |
55 |
-3. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html |
56 |
-4. https://github.com/graysky2/kernel_gcc_patch/issues/15 |
57 |
-5. http://www.linuxforge.net/docs/linux/linux-gcc.php |
58 |
+1. https://gcc.gnu.org/gcc-4.9/changes.html |
59 |
+2. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html |
60 |
+3a. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95671#c11 |
61 |
+3b. https://github.com/graysky2/kernel_gcc_patch/issues/55 |
62 |
+4. https://bugzilla.kernel.org/show_bug.cgi?id=77461 |
63 |
+5. https://github.com/graysky2/kernel_gcc_patch/issues/15 |
64 |
+6. http://www.linuxforge.net/docs/linux/linux-gcc.php |
65 |
|
66 |
---- a/arch/x86/include/asm/module.h 2019-08-16 04:11:12.000000000 -0400 |
67 |
-+++ b/arch/x86/include/asm/module.h 2019-08-22 15:56:23.988050322 -0400 |
68 |
+--- a/arch/x86/include/asm/module.h 2020-06-10 15:35:02.000000000 -0400 |
69 |
++++ b/arch/x86/include/asm/module.h 2020-06-15 10:38:25.646459545 -0400 |
70 |
@@ -25,6 +25,36 @@ struct mod_arch_specific { |
71 |
#define MODULE_PROC_FAMILY "586MMX " |
72 |
#elif defined CONFIG_MCORE2 |
73 |
@@ -141,8 +147,8 @@ REFERENCES |
74 |
#elif defined CONFIG_MELAN |
75 |
#define MODULE_PROC_FAMILY "ELAN " |
76 |
#elif defined CONFIG_MCRUSOE |
77 |
---- a/arch/x86/Kconfig.cpu 2019-08-16 04:11:12.000000000 -0400 |
78 |
-+++ b/arch/x86/Kconfig.cpu 2019-08-22 15:59:31.596946943 -0400 |
79 |
+--- a/arch/x86/Kconfig.cpu 2020-06-10 15:35:02.000000000 -0400 |
80 |
++++ b/arch/x86/Kconfig.cpu 2020-06-15 10:38:25.646459545 -0400 |
81 |
@@ -116,6 +116,7 @@ config MPENTIUMM |
82 |
config MPENTIUM4 |
83 |
bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon" |
84 |
@@ -524,9 +530,9 @@ REFERENCES |
85 |
|
86 |
config X86_MINIMUM_CPU_FAMILY |
87 |
int |
88 |
---- a/arch/x86/Makefile 2019-08-16 04:11:12.000000000 -0400 |
89 |
-+++ b/arch/x86/Makefile 2019-08-22 16:01:22.559789904 -0400 |
90 |
-@@ -118,13 +118,53 @@ else |
91 |
+--- a/arch/x86/Makefile 2020-06-10 15:35:02.000000000 -0400 |
92 |
++++ b/arch/x86/Makefile 2020-06-15 10:38:54.653775572 -0400 |
93 |
+@@ -119,13 +119,56 @@ else |
94 |
KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup) |
95 |
|
96 |
# FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu) |
97 |
@@ -539,8 +545,11 @@ REFERENCES |
98 |
+ cflags-$(CONFIG_MJAGUAR) += $(call cc-option,-march=btver2) |
99 |
+ cflags-$(CONFIG_MBULLDOZER) += $(call cc-option,-march=bdver1) |
100 |
+ cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2) |
101 |
++ cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-mno-tbm) |
102 |
+ cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-march=bdver3) |
103 |
++ cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-mno-tbm) |
104 |
+ cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-march=bdver4) |
105 |
++ cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-mno-tbm) |
106 |
+ cflags-$(CONFIG_MZEN) += $(call cc-option,-march=znver1) |
107 |
+ cflags-$(CONFIG_MZEN2) += $(call cc-option,-march=znver2) |
108 |
cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona) |
109 |
@@ -576,15 +585,15 @@ REFERENCES |
110 |
+ $(call cc-option,-march=cannonlake,$(call cc-option,-mtune=cannonlake)) |
111 |
+ cflags-$(CONFIG_MICELAKE) += \ |
112 |
+ $(call cc-option,-march=icelake-client,$(call cc-option,-mtune=icelake-client)) |
113 |
-+ cflags-$(CONFIG_MCASCADE) += \ |
114 |
++ cflags-$(CONFIG_MCASCADELAKE) += \ |
115 |
+ $(call cc-option,-march=cascadelake,$(call cc-option,-mtune=cascadelake)) |
116 |
+ cflags-$(CONFIG_MATOM) += $(call cc-option,-march=bonnell) \ |
117 |
+ $(call cc-option,-mtune=bonnell,$(call cc-option,-mtune=generic)) |
118 |
cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic) |
119 |
KBUILD_CFLAGS += $(cflags-y) |
120 |
|
121 |
---- a/arch/x86/Makefile_32.cpu 2019-08-16 04:11:12.000000000 -0400 |
122 |
-+++ b/arch/x86/Makefile_32.cpu 2019-08-22 16:02:14.687701216 -0400 |
123 |
+--- a/arch/x86/Makefile_32.cpu 2020-06-10 15:35:02.000000000 -0400 |
124 |
++++ b/arch/x86/Makefile_32.cpu 2020-06-15 10:38:25.646459545 -0400 |
125 |
@@ -23,7 +23,19 @@ cflags-$(CONFIG_MK6) += -march=k6 |
126 |
# Please note, that patches that add -march=athlon-xp and friends are pointless. |
127 |
# They make zero difference whatsosever to performance at this time. |