mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: <peder.bergan@gmail.com>, "Miguel Ojeda" <ojeda@kernel.org>
Cc: "Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nsc@kernel.org>,
	<rust-for-linux@vger.kernel.org>, <linux-kbuild@vger.kernel.org>,
	<llvm@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kbuild: rust: drop the obsolete libclang stack-init probe
Date: Wed, 25 Nov 2026 15:39:25 +0000	[thread overview]
Message-ID: <DN4EKVFD8CH8.3T0EBPKGR2LEX@garyguo.net> (raw)
In-Reply-To: <20261125-perf-rust-bindgen-drop-legacy-clang-v1-1-dafbf8d4d3df@gmail.com>

On Wed Nov 25, 2026 at 10:32 AM GMT, Peder Bergan via B4 Relay wrote:
> From: Peder Bergan <peder.bergan@gmail.com>
>
> For Rust-enabled GCC builds with CONFIG_INIT_STACK_ALL_ZERO, the Rust
> Makefile runs bindgen to check whether libclang needs the old enabler
> for -ftrivial-auto-var-init=zero. LLVM 16 made the flag usable on its own,
> and the Rust toolchain check already requires libclang 17.0.1 or newer
> (18.0.0 on LoongArch).
>
> Drop the obsolete enabler and the bindgen invocation that selects it.
> On this rust-next base, median warm make prepare time fell from 0.72 s
> to 0.49 s over ten runs per version on x86-64 with GCC 16.2.1, libclang
> 23.1.5 and bindgen 0.73.2. For both GCC and Clang, the generated kernel,
> helper and UAPI bindings matched byte for byte before and after the
> change.
>
> Signed-off-by: Peder Bergan <peder.bergan@gmail.com>

Link: https://github.com/llvm/llvm-project/issues/44842
Reviewed-by: Gary Guo <gary@garyguo.net>

> ---
> OpenAI Codex assisted with coding and testing.
> ---
>  rust/Makefile | 14 --------------
>  1 file changed, 14 deletions(-)
>
> diff --git a/rust/Makefile b/rust/Makefile
> index 6dceabbf02c87..66b06ad6f11df 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -483,20 +483,6 @@ BINDGEN_TARGET		:= $(BINDGEN_TARGET_$(SRCARCH))
>  # some configurations, with new GCC versions, etc.
>  bindgen_extra_c_flags = -w --target=$(BINDGEN_TARGET)
>  
> -# Auto variable zero-initialization requires an additional special option with
> -# clang that is going to be removed sometime in the future (likely in
> -# clang-18), so make sure to pass this option only if clang supports it
> -# (libclang major version < 16).
> -#
> -# https://github.com/llvm/llvm-project/issues/44842
> -# https://github.com/llvm/llvm-project/blob/llvmorg-16.0.0-rc2/clang/docs/ReleaseNotes.rst#deprecated-compiler-flags
> -ifdef CONFIG_INIT_STACK_ALL_ZERO
> -libclang_maj_ver=$(shell $(BINDGEN) $(srctree)/scripts/rust_is_available_bindgen_libclang.h 2>&1 | sed -ne 's/.*clang version \([0-9]*\).*/\1/p')
> -ifeq ($(shell expr $(libclang_maj_ver) \< 16), 1)
> -bindgen_extra_c_flags += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
> -endif
> -endif
> -
>  bindgen_c_flags = $(filter-out $(bindgen_skip_c_flags), $(c_flags)) \
>  	$(bindgen_extra_c_flags)
>  endif
>
> ---
> base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
> change-id: 20261125-perf-rust-bindgen-drop-legacy-clang-149a05cc71a9
>
> Best regards,
> --  
> Peder Bergan <peder.bergan@gmail.com>



      reply	other threads:[~2026-11-25 15:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 10:32 Peder Bergan via B4 Relay
2026-11-25 15:39 ` Gary Guo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DN4EKVFD8CH8.3T0EBPKGR2LEX@garyguo.net \
    --to=gary@garyguo.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=peder.bergan@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®