From: Alice Ryhl <aliceryhl@google.com>
To: Gary Guo <gary@garyguo.net>
Cc: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nsc@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Tamir Duberstein" <tamird@kernel.org>,
"Jesung Yang" <y.j3ms.n@gmail.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Carlos Llamas" <cmllamas@google.com>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 0/2] Change Rust Binder crate name to rust_binder
Date: Thu, 5 Mar 2026 12:27:34 +0000 [thread overview]
Message-ID: <aal2toHN877W0Sf3@google.com> (raw)
In-Reply-To: <DGUUC74P2D10.30VWI1W6CR6Z2@garyguo.net>
On Thu, Mar 05, 2026 at 12:17:52PM +0000, Gary Guo wrote:
> On Thu Mar 5, 2026 at 10:49 AM GMT, Alice Ryhl wrote:
> > On Tue, Feb 24, 2026 at 03:17:16PM +0000, Alice Ryhl wrote:
> >> On Tue, Feb 24, 2026 at 02:24:59PM +0100, Miguel Ojeda wrote:
> >> > On Tue, Feb 24, 2026 at 10:38 AM Alice Ryhl <aliceryhl@google.com> wrote:
> >> > >
> >> > > Currently the crate name of the Rust Binder driver is rust_binder_main,
> >> > > but I'd like it to be called rust_binder instead. This affects e.g.
> >> > > symbol names in stack traces.
> >> >
> >> > We discussed allowing to customize crate names years ago, at least for
> >> > dashes vs. underscores, for matching C names more closely and perhaps
> >> > other needs.
> >> >
> >> > Back then, we decided to keep things simple to avoid confusion (i.e. a
> >> > single identifier used everywhere the same way is simpler, at least
> >> > for humans) and to avoid having to deal with those dual names
> >> > everywhere (e.g. adding workarounds for rust-analyzer here).
> >> >
> >> > I talked with Alice about what she needed here -- could we rename that
> >> > source file to just something like `binder`? That would avoid the need
> >> > to have a custom name, so everything would still match (symbols,
> >> > source file, object file...), and it would give you even shorter
> >> > names.
> >>
> >> Sure just renaming rust_binder_main.rs to binder.rs would work too.
> >
> > I realized that there's a much simpler way to allow crates to rename
> > themselves: do not pass the --crate-name argument at all.
> >
> > Because if you do not pass this argument, then rustc will use the
> > name of the .rs file as the crate name by default, *but* if the crate
> > contains #![crate_name = "..."], then that will be used instead.
> >
> > Do you still want to enforce that the crate name always matches the
> > file name? It seems unfortunate that it's currently impossible to create
> > a Rust module where the .ko file and crate name is the same, unless no
> > extra object files are linked into the module.
>
> I think previously a fixed crate name is load-bearing because we need rustc to
> emit outputs to a fixed location.
>
> This shouldn't be needed after commit 295d8398c67e ("kbuild: specify output
> names separately for each emission type from rustc"), so if nothing breaks with
> `--crate-name` removed, then I think it makes sense to drop it to allow custom
> rustflags to override them.
Are you sure? I know this commit shows up in blame, but it just adds a
backslash to the --crate-name argument.
I do not believe that omitting --crate-name changes anything in cases
where the crate name already matches the file name.
Alice
next prev parent reply other threads:[~2026-03-05 12:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 9:38 [PATCH 0/2] Change Rust Binder crate name to rust_binder Alice Ryhl
2026-02-24 9:38 ` [PATCH 1/2] rust: support overriding crate_name Alice Ryhl
2026-02-24 9:38 ` [PATCH 2/2] rust_binder: override crate name to rust_binder Alice Ryhl
2026-02-24 13:24 ` [PATCH 0/2] Change Rust Binder " Miguel Ojeda
2026-02-24 15:17 ` Alice Ryhl
2026-03-05 10:49 ` Alice Ryhl
2026-03-05 12:17 ` Gary Guo
2026-03-05 12:27 ` Alice Ryhl [this message]
2026-03-05 12:34 ` Gary Guo
2026-03-05 12:44 ` Alice Ryhl
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=aal2toHN877W0Sf3@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=cmllamas@google.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=y.j3ms.n@gmail.com \
/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