]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
rules.mk: respect the empty CONFIG_HOST_FLAGS_OPT 18815/head
authorShiji Yang <yangshiji66@outlook.com>
Fri, 16 May 2025 11:30:30 +0000 (19:30 +0800)
committerRobert Marko <robimarko@gmail.com>
Fri, 16 May 2025 18:42:43 +0000 (20:42 +0200)
Currently, the empty CONFIG_HOST_FLAGS_OPT will be overridden by
"-O2". Fix this issue by checking if its parent menuconfig symbol
CONFIG_OPTIMIZE_HOST_TOOLS was defined.

Fixes: e3bec5692c50 ("rules.mk: set default host tools GCC optimization level to -O2")
Reported-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/18815
Signed-off-by: Robert Marko <robimarko@gmail.com>
rules.mk

index 3971852f454a310fdea0d2b7ed042c1e386533f7..929d8e00e8d02a393a9fbc1a488ea40c379e30a2 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -278,7 +278,7 @@ PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config
 
 export PKG_CONFIG
 
-HOST_FLAGS_OPT:=$(if $(CONFIG_HOST_FLAGS_OPT),$(call qstrip,$(CONFIG_HOST_FLAGS_OPT)),"-O2")
+HOST_FLAGS_OPT:=$(if $(CONFIG_OPTIMIZE_HOST_TOOLS),$(call qstrip,$(CONFIG_HOST_FLAGS_OPT)),-O2)
 HOST_FLAGS_STRIP:=$(call qstrip,$(CONFIG_HOST_FLAGS_STRIP))
 HOST_EXTRA_CFLAGS:=$(call qstrip,$(CONFIG_HOST_EXTRA_CFLAGS))
 HOST_EXTRA_CXXFLAGS:=$(call qstrip,$(CONFIG_HOST_EXTRA_CXXFLAGS))