commit: cb65e6066a41df243404a5fa57079315641c156c Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> AuthorDate: Mon Jun 29 17:43:25 2020 +0000 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> CommitDate: Mon Jun 29 17:43:25 2020 +0000 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=cb65e606
Update gcc optimization patch for gcc v9.1+ Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> 5012_enable-cpu-optimizations-for-gcc91.patch | 49 ++++++++++++++++----------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/5012_enable-cpu-optimizations-for-gcc91.patch b/5012_enable-cpu-optimizations-for-gcc91.patch index dffd36d..8f35520 100644 --- a/5012_enable-cpu-optimizations-for-gcc91.patch +++ b/5012_enable-cpu-optimizations-for-gcc91.patch @@ -42,14 +42,18 @@ It also offers to compile passing the 'native' option which, "selects the CPU to generate code for at compilation time by determining the processor type of the compiling machine. Using -march=native enables all instruction subsets supported by the local machine and will produce code optimized for the local -machine under the constraints of the selected instruction set."[3] +machine under the constraints of the selected instruction set."[2] + +Do NOT try using the 'native' option on AMD Piledriver, Steamroller, or +Excavator CPUs (-march=bdver{2,3,4} flag). The build will error out due the +kernel's objtool issue with these.[3a,b] MINOR NOTES This patch also changes 'atom' to 'bonnell' in accordance with the gcc v4.9 changes. Note that upstream is using the deprecated 'match=atom' flags when I -believe it should use the newer 'march=bonnell' flag for atom processors.[2] +believe it should use the newer 'march=bonnell' flag for atom processors.[4] -It is not recommended to compile on Atom-CPUs with the 'native' option.[4] The +It is not recommended to compile on Atom-CPUs with the 'native' option.[5] The recommendation is to use the 'atom' option instead. BENEFITS @@ -61,20 +65,22 @@ https://github.com/graysky2/kernel_gcc_patch REQUIREMENTS linux version >=4.13 -gcc version >=9.1 +gcc version >=9.1 and <10 ACKNOWLEDGMENTS -This patch builds on the seminal work by Jeroen.[5] +This patch builds on the seminal work by Jeroen.[6] REFERENCES -1. https://gcc.gnu.org/gcc-4.9/changes.html -2. https://bugzilla.kernel.org/show_bug.cgi?id=77461 -3. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html -4. https://github.com/graysky2/kernel_gcc_patch/issues/15 -5. http://www.linuxforge.net/docs/linux/linux-gcc.php +1. https://gcc.gnu.org/gcc-4.9/changes.html +2. https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html +3a. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95671#c11 +3b. https://github.com/graysky2/kernel_gcc_patch/issues/55 +4. https://bugzilla.kernel.org/show_bug.cgi?id=77461 +5. https://github.com/graysky2/kernel_gcc_patch/issues/15 +6. http://www.linuxforge.net/docs/linux/linux-gcc.php ---- a/arch/x86/include/asm/module.h 2019-08-16 04:11:12.000000000 -0400 -+++ b/arch/x86/include/asm/module.h 2019-08-22 15:56:23.988050322 -0400 +--- a/arch/x86/include/asm/module.h 2020-06-10 15:35:02.000000000 -0400 ++++ b/arch/x86/include/asm/module.h 2020-06-15 10:38:25.646459545 -0400 @@ -25,6 +25,36 @@ struct mod_arch_specific { #define MODULE_PROC_FAMILY "586MMX " #elif defined CONFIG_MCORE2 @@ -141,8 +147,8 @@ REFERENCES #elif defined CONFIG_MELAN #define MODULE_PROC_FAMILY "ELAN " #elif defined CONFIG_MCRUSOE ---- a/arch/x86/Kconfig.cpu 2019-08-16 04:11:12.000000000 -0400 -+++ b/arch/x86/Kconfig.cpu 2019-08-22 15:59:31.596946943 -0400 +--- a/arch/x86/Kconfig.cpu 2020-06-10 15:35:02.000000000 -0400 ++++ b/arch/x86/Kconfig.cpu 2020-06-15 10:38:25.646459545 -0400 @@ -116,6 +116,7 @@ config MPENTIUMM config MPENTIUM4 bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon" @@ -524,9 +530,9 @@ REFERENCES config X86_MINIMUM_CPU_FAMILY int ---- a/arch/x86/Makefile 2019-08-16 04:11:12.000000000 -0400 -+++ b/arch/x86/Makefile 2019-08-22 16:01:22.559789904 -0400 -@@ -118,13 +118,53 @@ else +--- a/arch/x86/Makefile 2020-06-10 15:35:02.000000000 -0400 ++++ b/arch/x86/Makefile 2020-06-15 10:38:54.653775572 -0400 +@@ -119,13 +119,56 @@ else KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup) # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu) @@ -539,8 +545,11 @@ REFERENCES + cflags-$(CONFIG_MJAGUAR) += $(call cc-option,-march=btver2) + cflags-$(CONFIG_MBULLDOZER) += $(call cc-option,-march=bdver1) + cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-march=bdver2) ++ cflags-$(CONFIG_MPILEDRIVER) += $(call cc-option,-mno-tbm) + cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-march=bdver3) ++ cflags-$(CONFIG_MSTEAMROLLER) += $(call cc-option,-mno-tbm) + cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-march=bdver4) ++ cflags-$(CONFIG_MEXCAVATOR) += $(call cc-option,-mno-tbm) + cflags-$(CONFIG_MZEN) += $(call cc-option,-march=znver1) + cflags-$(CONFIG_MZEN2) += $(call cc-option,-march=znver2) cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona) @@ -576,15 +585,15 @@ REFERENCES + $(call cc-option,-march=cannonlake,$(call cc-option,-mtune=cannonlake)) + cflags-$(CONFIG_MICELAKE) += \ + $(call cc-option,-march=icelake-client,$(call cc-option,-mtune=icelake-client)) -+ cflags-$(CONFIG_MCASCADE) += \ ++ cflags-$(CONFIG_MCASCADELAKE) += \ + $(call cc-option,-march=cascadelake,$(call cc-option,-mtune=cascadelake)) + cflags-$(CONFIG_MATOM) += $(call cc-option,-march=bonnell) \ + $(call cc-option,-mtune=bonnell,$(call cc-option,-mtune=generic)) cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic) KBUILD_CFLAGS += $(cflags-y) ---- a/arch/x86/Makefile_32.cpu 2019-08-16 04:11:12.000000000 -0400 -+++ b/arch/x86/Makefile_32.cpu 2019-08-22 16:02:14.687701216 -0400 +--- a/arch/x86/Makefile_32.cpu 2020-06-10 15:35:02.000000000 -0400 ++++ b/arch/x86/Makefile_32.cpu 2020-06-15 10:38:25.646459545 -0400 @@ -23,7 +23,19 @@ cflags-$(CONFIG_MK6) += -march=k6 # Please note, that patches that add -march=athlon-xp and friends are pointless. # They make zero difference whatsosever to performance at this time.