From 4ed54351867c3178a01cd7ee5c47de8e8eaa4a5b Mon Sep 17 00:00:00 2001 From: WangYuli Date: Wed, 11 Sep 2024 10:15:05 +0800 Subject: [PATCH] deepin: kbuild: Reapply support for CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 1. Revert (a6036a41bffb "kbuild: drop support for CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3") 2. Mark -O3 as experimental, as it might cause unwanted regressions for users. 3. Allow all architectures to use the experimental -O3 optimization option. Previously, only ARC was allowed to use this option. Link: https://lore.kernel.org/lkml/20191211104619.114557-1-oleksandr@redhat.com/ Signed-off-by: Oleksandr Natalenko Link: https://lore.kernel.org/lkml/20220621133526.29662-1-mikoxyzzz@gmail.com/ Signed-off-by: Miko Larsson Signed-off-by: WangYuli --- Makefile | 3 +++ init/Kconfig | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/Makefile b/Makefile index b84a1b3e15c5..4615ba0a9baf 100644 --- a/Makefile +++ b/Makefile @@ -819,6 +819,9 @@ KBUILD_CFLAGS += -fno-delete-null-pointer-checks ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE KBUILD_CFLAGS += -O2 KBUILD_RUSTFLAGS += -Copt-level=2 +else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 +KBUILD_CFLAGS += -O3 +KBUILD_RUSTFLAGS += -Copt-level=3 else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os KBUILD_RUSTFLAGS += -Copt-level=s diff --git a/init/Kconfig b/init/Kconfig index 70abc9e29460..b382bd4c1d88 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1377,6 +1377,15 @@ config CC_OPTIMIZE_FOR_PERFORMANCE with the "-O2" compiler flag for best performance and most helpful compile-time warnings. +config CC_OPTIMIZE_FOR_PERFORMANCE_O3 + bool "Optimize more for performance (-O3) (EXPERIMENTAL)" + help + Choosing this option will pass "-O3" to your compiler to optimize + the kernel yet more for performance. + + This option is EXPERIMENTAL; you may encounter compiler bugs and/or + kernel bugs with this option enabled. + config CC_OPTIMIZE_FOR_SIZE bool "Optimize for size (-Os)" help