Re: [PATCH v6 00/24] tools build: Append -fzero-init-padding-bits=all option

From: Andrew Morton

Date: Mon Mar 23 2026 - 18:13:25 EST


On Mon, 23 Mar 2026 15:13:21 +0000 Leo Yan <leo.yan@xxxxxxx> wrote:

> GCC-15 doesn't guarantee that a {0} initializer clears the whole union [1].
> This may cause bugs if data is not intialized properly.
>
> The kernel enabld the -fzero-init-padding-bits=all option to tackle the
> issue, which was merged in commit dce4aab8441d ("kbuild: Use
> -fzero-init-padding-bits=all").
>
> This series propagates the same flag to the tools build. It uses
> tools/scripts/Makefile.include as the central place to add the
> option to EXTRA_CFLAGS and HOST_EXTRACFLAGS for the CC and HOSTCC
> compilers. Each project under tools/ appends the variables as needed.
>
> BPF/bpftool related patches will be sent separately, as maintainers
> prefer them to go via the BPF tree.

Some questions from AI review. Some probably legit, some probably not:

https://sashiko.dev/#/patchset/20260323-tools_build_fix_zero_init-v6-0-235858c51af9@xxxxxxx