* [PATCH v2] kbuild: expand inlining hints with -fdiagnostics-show-inlining-chain
@ 2026-03-31 0:09 Justin Stitt
2026-03-31 5:27 ` Kees Cook
2026-03-31 15:55 ` Nathan Chancellor
0 siblings, 2 replies; 3+ messages in thread
From: Justin Stitt @ 2026-03-31 0:09 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
Bill Wendling
Cc: Kees Cook, linux-kbuild, linux-kernel, llvm, Justin Stitt
Clang recently added -fdiagnostics-show-inlining-chain [1] to improve
the visibility of inlining chains in diagnostics. This is particularly
useful for CONFIG_FORTIFY_SOURCE where detections can happen deep in
inlined functions.
Add this flag to KBUILD_CFLAGS under a cc-option so it is enabled if the
compiler supports it. Note that GCC does not have an equivalent flag as
it supports a similar diagnostic structure unconditionally.
Link: https://github.com/llvm/llvm-project/pull/174892 [1]
Link: https://github.com/ClangBuiltLinux/linux/issues/1571
Signed-off-by: Justin Stitt <justinstitt@google.com>
---
Changes in v2:
- Move to always enable option if compiler supports it (thanks Nathan,
Kees)
- Change commit title and message
- Link to v1: https://lore.kernel.org/r/20260327-kbuild-show-inlining-v1-1-730ac2cae571@google.com
---
Makefile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Makefile b/Makefile
index e1279c4d5b24..4972b23fb77f 100644
--- a/Makefile
+++ b/Makefile
@@ -973,6 +973,10 @@ KBUILD_CFLAGS += $(call cc-option, -fno-stack-clash-protection)
# Get details on warnings generated due to GCC value tracking.
KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-context=2)
+# Show inlining notes for __attribute__((warning/error)) call chains.
+# GCC supports this unconditionally while Clang 23+ provides a flag.
+KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-inlining-chain)
+
# Clear used registers at func exit (to reduce data lifetime and ROP gadgets).
ifdef CONFIG_ZERO_CALL_USED_REGS
KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr
---
base-commit: 7df48e36313029e4c0907b2023905dd7213fd678
change-id: 20260327-kbuild-show-inlining-557d31d2293a
Best regards,
--
Justin Stitt <justinstitt@google.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] kbuild: expand inlining hints with -fdiagnostics-show-inlining-chain
2026-03-31 0:09 [PATCH v2] kbuild: expand inlining hints with -fdiagnostics-show-inlining-chain Justin Stitt
@ 2026-03-31 5:27 ` Kees Cook
2026-03-31 15:55 ` Nathan Chancellor
1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2026-03-31 5:27 UTC (permalink / raw)
To: Justin Stitt
Cc: Nathan Chancellor, Nicolas Schier, Nick Desaulniers,
Bill Wendling, linux-kbuild, linux-kernel, llvm
On Mon, Mar 30, 2026 at 05:09:08PM -0700, Justin Stitt wrote:
> Clang recently added -fdiagnostics-show-inlining-chain [1] to improve
> the visibility of inlining chains in diagnostics. This is particularly
> useful for CONFIG_FORTIFY_SOURCE where detections can happen deep in
> inlined functions.
>
> Add this flag to KBUILD_CFLAGS under a cc-option so it is enabled if the
> compiler supports it. Note that GCC does not have an equivalent flag as
> it supports a similar diagnostic structure unconditionally.
>
> Link: https://github.com/llvm/llvm-project/pull/174892 [1]
> Link: https://github.com/ClangBuiltLinux/linux/issues/1571
> Signed-off-by: Justin Stitt <justinstitt@google.com>
Thanks!
Reviewed-by: Kees Cook <kees@kernel.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] kbuild: expand inlining hints with -fdiagnostics-show-inlining-chain
2026-03-31 0:09 [PATCH v2] kbuild: expand inlining hints with -fdiagnostics-show-inlining-chain Justin Stitt
2026-03-31 5:27 ` Kees Cook
@ 2026-03-31 15:55 ` Nathan Chancellor
1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2026-03-31 15:55 UTC (permalink / raw)
To: Justin Stitt
Cc: Nicolas Schier, Nick Desaulniers, Bill Wendling, Kees Cook,
linux-kbuild, linux-kernel, llvm
On Mon, Mar 30, 2026 at 05:09:08PM -0700, Justin Stitt wrote:
> Clang recently added -fdiagnostics-show-inlining-chain [1] to improve
> the visibility of inlining chains in diagnostics. This is particularly
> useful for CONFIG_FORTIFY_SOURCE where detections can happen deep in
> inlined functions.
>
> Add this flag to KBUILD_CFLAGS under a cc-option so it is enabled if the
> compiler supports it. Note that GCC does not have an equivalent flag as
> it supports a similar diagnostic structure unconditionally.
>
> Link: https://github.com/llvm/llvm-project/pull/174892 [1]
> Link: https://github.com/ClangBuiltLinux/linux/issues/1571
> Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> Changes in v2:
> - Move to always enable option if compiler supports it (thanks Nathan,
> Kees)
> - Change commit title and message
> - Link to v1: https://lore.kernel.org/r/20260327-kbuild-show-inlining-v1-1-730ac2cae571@google.com
> ---
> Makefile | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index e1279c4d5b24..4972b23fb77f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -973,6 +973,10 @@ KBUILD_CFLAGS += $(call cc-option, -fno-stack-clash-protection)
> # Get details on warnings generated due to GCC value tracking.
> KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-context=2)
>
> +# Show inlining notes for __attribute__((warning/error)) call chains.
> +# GCC supports this unconditionally while Clang 23+ provides a flag.
> +KBUILD_CFLAGS += $(call cc-option, -fdiagnostics-show-inlining-chain)
> +
> # Clear used registers at func exit (to reduce data lifetime and ROP gadgets).
> ifdef CONFIG_ZERO_CALL_USED_REGS
> KBUILD_CFLAGS += -fzero-call-used-regs=used-gpr
>
> ---
> base-commit: 7df48e36313029e4c0907b2023905dd7213fd678
> change-id: 20260327-kbuild-show-inlining-557d31d2293a
>
> Best regards,
> --
> Justin Stitt <justinstitt@google.com>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-31 15:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-31 0:09 [PATCH v2] kbuild: expand inlining hints with -fdiagnostics-show-inlining-chain Justin Stitt
2026-03-31 5:27 ` Kees Cook
2026-03-31 15:55 ` Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox