Hi Nicolas, Nathan, Kees,

  Thanks for the feedback.

  Would it be acceptable to handle this generically for external modules in
  top-level kbuild (`Makefile`) instead of tying it to kstack_erase? I was
  thinking about adding:

    diff --git a/Makefile b/Makefile
    @@ -1057,6 +1057,10 @@ include $(addprefix $(srctree)/, $(include-y))
     # Do not add $(call cc-option,...) below this line. When you build the 
kernel
     # from the clean source tree, the GCC plugins do not exist at this point.

    +ifneq ($(KBUILD_EXTMOD),)
    +KBUILD_CFLAGS += -gno-record-gcc-switches
    +endif
    +
     # Add user supplied CPPFLAGS, AFLAGS, CFLAGS and RUSTFLAGS as the last 
assignments

  This would avoid per-module changes and also avoid coupling a generic
  compiler switch-recording behavior to `CONFIG_GCC_PLUGIN_STACKLEAK`.

  If this direction looks reasonable, I can send it as an RFC patch for review.

  Thanks,
  Jaihind

-----Original Message-----
From: Nathan Chancellor <[email protected]> 
Sent: Saturday, August 15, 2026 4:16 AM
To: Nicolas Schier <[email protected]>
Cc: Jaihind Yadav <[email protected]>; Kees Cook <[email protected]>; 
[email protected]; [email protected]; 
[email protected]; [email protected]
Subject: Re: [PATCH v2] kstack_erase: suppress -grecord-gcc-switches for 
external module builds

WARNING: This email originated from outside of Qualcomm. Please be wary of any 
links or attachments, and do not enable macros.

On Fri, Aug 14, 2026 at 08:23:02PM +0200, Nicolas Schier wrote:
> If there is a need for external kmods to to have
>
>   make modules KCFLAGS=-gno-record-gcc-switches

Ah yeah, I forgot about KCFLAGS for the external module build. An external 
module could also include

  ccflags-y := -gno-record-gcc-switches

in its build file as well if this is a requirement of their build setup.
Perhaps we could revisit this within Kbuild if there is enough interest from 
various parties.

--
Cheers,
Nathan

Reply via email to