On 1/2/26 08:12, Ilias Apalodimas wrote:
Hi Heinrich,

On Wed, 31 Dec 2025 at 21:11, Heinrich Schuchardt
<[email protected]> wrote:

Since commit 5f520875bdf0 ("kbuild: Bump the build system to 5.1")
CONFIG_CC_OPTIMIZE_FOR_DEBUG has no effect on the non-host code.

This patch reestablishes the prior logic to add

     -Og -Wno-maybe-uninitialized

to KBUILD_CFLAGS.

Fixes: 5f520875bdf0 ("kbuild: Bump the build system to 5.1")
Signed-off-by: Heinrich Schuchardt <[email protected]>
---
  Makefile | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index 6b5c5ee019e..2a972af4906 100644
--- a/Makefile
+++ b/Makefile
@@ -869,6 +869,11 @@ endif

  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
  KBUILD_CFLAGS  += -Os
+else ifdef CONFIG_CC_OPTIMIZE_FOR_DEBUG
+-KBUILD_CFLAGS  += -Og
+# Avoid false positives -Wmaybe-uninitialized
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78394
+KBUILD_CFLAGS  += -Wno-maybe-uninitialized
  else

There's a ifdev CONFIG_CC_OPTIMIZE_FOR_DEBUG a few lines above.
Wouldn't it be better to move the HOSTCFLAGS under the new ifdef as
well?

Whether the Makefile is organized by host vs. device or by Kconfig flags is a matter of taste. In your patch 5f520875bdf0 you opted to organize the code by host vs. device (like in the pre 5f520875bdf0 era) and my patch keeps it that way adding the least invasive change.

Best regards

Heinrich


Cheers
/Ilias
  KBUILD_CFLAGS   += -O2
  endif
--
2.51.0


Reply via email to