Skip to content

Commit

Permalink
deepin: kbuild: Reapply support for CONFIG_CC_OPTIMIZE_FOR_PERFORMANC…
Browse files Browse the repository at this point in the history
…E_O3

1. Revert (a6036a4
   "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/[email protected]/
Signed-off-by: Oleksandr Natalenko <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]/
Signed-off-by: Miko Larsson <[email protected]>
Signed-off-by: WangYuli <[email protected]>
  • Loading branch information
Avenger-285714 committed Sep 11, 2024
1 parent 183c4b7 commit 4ed5435
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4ed5435

Please sign in to comment.