deepin: kbuild: Reapply support for CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3

1. Revert (a6036a41bf
   "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 <oleksandr@redhat.com>
Link: https://lore.kernel.org/lkml/20220621133526.29662-1-mikoxyzzz@gmail.com/
Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
This commit is contained in:
WangYuli 2024-09-11 10:15:05 +08:00
parent 5cecaf955e
commit 3f14ea927e
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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