From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CB4D38E5D4; Mon, 9 Mar 2026 10:18:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773051481; cv=none; b=Gbeb43UxkMe+lH+y7CA5HwKtfekBf6SiOYll974w6Zw9VMCtp7mCi0TJacynk19WUdeJPxGGXySCLZf3fEi5mIJlNfj3RRDxqbf2j6kSKg6PXiErxmzsdKWW7HVFZoS0J2j5GYBijGwk7D2C6MTriO3MgTIkKU50yh/Om4YwIvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773051481; c=relaxed/simple; bh=2EC+wTYFQkxUTDCtHiHCoOwNgIgiRnx9FT0UQMAHILc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=nucLicAECL9GKzsd739R2TTRN96g2tBgDbOcBWdhWFbC01mOgeeWGUNG829erCe5WwsiqzM8xWHN5OCx6AIbmtqUsl2BYdMLlebXtX5nfTzbo5N61iuCRbfTi741hWODrLiDFqVvbPy3N9qX0oQPiCL0OQZzPJJVvdUZiOlkkuQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FMlHZ2gs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FMlHZ2gs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B123C2BCAF; Mon, 9 Mar 2026 10:17:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773051480; bh=2EC+wTYFQkxUTDCtHiHCoOwNgIgiRnx9FT0UQMAHILc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=FMlHZ2gsXqYoMc0B50ulHkU+VdI0fwSM5vDNkmq/f/qa7R+ym3zrku8rvnOtBfdI6 dPxWyld6YnAtmcY3mEnhum3nQh6i4XWacWw9TEptM90xzKbBOjnTUjdYr4N2qP+ppo VTot2VEEurdk7y7tUuhOIzc1O5UWLf8Obsu3bb7hRulDQn3UXWynn6snRqBwydsefv Miva8ljrX780FoGNfNnhVIncoJ1aQqwv8Ihc5RqTm4nnSUzb84jHgnY73Wcz4NloqQ rduQPbZhjMuWbaxDavP9Dyd/NaSXhan6lR82SSCtLVk8gfL9qlpeNN0dxKR9SR/PLG /cBq3vYl7etrw== Message-ID: <8b5b0e81-436f-49f7-8d3c-9271d4d05ffc@kernel.org> Date: Mon, 9 Mar 2026 10:17:49 +0000 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 05/30] tools build: Append -fzero-init-padding-bits=all to extra cflags To: Leo Yan , Arnaldo Carvalho de Melo , Ian Rogers , Namhyung Kim , James Clark , Kees Cook , Nathan Chancellor , Nicolas Schier , Nick Desaulniers , Bill Wendling , Justin Stitt , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Adrian Hunter , Masami Hiramatsu , William Breathitt Gray , Barry Song , Qinxin Xia , Bartosz Golaszewski , Kent Gibson , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Jonathan Cameron , David Lechner , =?UTF-8?Q?Nuno_S=C3=A1?= , Andy Shevchenko , Andrew Morton , Willy Tarreau , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Josh Poimboeuf , Robert Moore , Len Brown , Srinivas Pandruvada , Tejun Heo , David Vernet , Andrea Righi , Changwoo Min , Mark Brown , Steven Rostedt , Gabriele Monaco , Shuah Khan , Jiri Kosina , Benjamin Tissoires Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org References: <20260308-tools_build_fix_zero_init-v3-0-6477808123b7@arm.com> <20260308-tools_build_fix_zero_init-v3-5-6477808123b7@arm.com> From: Quentin Monnet Content-Language: en-GB In-Reply-To: <20260308-tools_build_fix_zero_init-v3-5-6477808123b7@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 2026-03-08 16:46 UTC+0000 ~ Leo Yan > GCC-15 release claims [1]: > > {0} initializer in C or C++ for unions no longer guarantees clearing > of the whole union (except for static storage duration initialization), > it just initializes the first union member to zero. If initialization > of the whole union including padding bits is desirable, use {} (valid > in C23 or C++) or use -fzero-init-padding-bits=unions option to > restore old GCC behavior. > > As a result, this new behaviour might cause unexpected data when we > initialize a union with using the '{ 0 }' initializer. > > Since commit dce4aab8441d ("kbuild: Use -fzero-init-padding-bits=all"), > the kernel has enabled -fzero-init-padding-bits=all to zero padding bits > in unions and structures. This commit applies the same option for tools > building. > > The option is not supported by any version older than GCC 15, nor is it > supported by LLVM. This patch adds the cc-option and host-cc-option > functions to dynamically detect compiler option and append it to the > EXTRA_CFLAGS and HOST_EXTRACFLAGS respectively. > > [1] https://gcc.gnu.org/gcc-15/changes.html > > Signed-off-by: Leo Yan I can't speak for the maintainers of the other tools of course, but as far as bpftool is concerned, this looks OK to me. Thanks for this work! Acked-by: Quentin Monnet