kernel: use KCFLAGS for passing EXTRA_OPTIMIZATION flags
authorRafał Miłecki <rafal@milecki.pl>
Wed, 15 Jun 2022 08:41:37 +0000 (10:41 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Sun, 19 Jun 2022 21:23:18 +0000 (23:23 +0200)
This uses kernel's generic variable and doesn't require patching it with
a custom Makefile change. It's expected *not* to change any behaviour.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
include/kernel.mk
target/linux/generic/pending-5.10/201-extra_optimization.patch
target/linux/generic/pending-5.15/201-extra_optimization.patch

index 01b737f132e642cbcff6de696075e75703144138..ffc9ea52603f8079daf8424526fa5a9a799e41c2 100644 (file)
@@ -101,7 +101,7 @@ endif
 KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)
 
 KERNEL_MAKE_FLAGS = \
-       KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR)))" \
+       KCFLAGS="$(call iremap,$(BUILD_DIR),$(notdir $(BUILD_DIR))) $(call qstrip,$(CONFIG_EXTRA_OPTIMIZATION))" \
        HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
        CROSS_COMPILE="$(KERNEL_CROSS)" \
        ARCH="$(LINUX_KARCH)" \
index cb1de80764109a832cc4561dd26838005f5e1920..dcf39c574ff2f258df12b1f6608b0983f44bc146 100644 (file)
@@ -14,18 +14,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/Makefile
 +++ b/Makefile
-@@ -735,11 +735,11 @@ KBUILD_CFLAGS    += $(call cc-disable-warni
- KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
- ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
--KBUILD_CFLAGS += -O2
-+KBUILD_CFLAGS += -O2 $(EXTRA_OPTIMIZATION)
+@@ -739,7 +739,7 @@ KBUILD_CFLAGS += -O2
  else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
--KBUILD_CFLAGS += -O3
-+KBUILD_CFLAGS += -O3 $(EXTRA_OPTIMIZATION)
+ KBUILD_CFLAGS += -O3
  else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 -KBUILD_CFLAGS += -Os
-+KBUILD_CFLAGS += -Os -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION)
++KBUILD_CFLAGS += -Os -fno-reorder-blocks -fno-tree-ch
  endif
  
  # Tell gcc to never replace conditional load with a non-conditional one
index 5300a5c4ab4d50a83c9fd4281f2af0d2828a2de5..96e93dde9b5e5014f4466e27d999c1b19987d0a9 100644 (file)
@@ -14,18 +14,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/Makefile
 +++ b/Makefile
-@@ -752,11 +752,11 @@ KBUILD_CFLAGS    += $(call cc-disable-warni
- KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
- ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE
--KBUILD_CFLAGS += -O2
-+KBUILD_CFLAGS += -O2 $(EXTRA_OPTIMIZATION)
+@@ -756,7 +756,7 @@ KBUILD_CFLAGS += -O2
  else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3
--KBUILD_CFLAGS += -O3
-+KBUILD_CFLAGS += -O3 $(EXTRA_OPTIMIZATION)
+ KBUILD_CFLAGS += -O3
  else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 -KBUILD_CFLAGS += -Os
-+KBUILD_CFLAGS += -Os -fno-reorder-blocks -fno-tree-ch $(EXTRA_OPTIMIZATION)
++KBUILD_CFLAGS += -Os -fno-reorder-blocks -fno-tree-ch
  endif
  
  # Tell gcc to never replace conditional load with a non-conditional one