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