From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B636739E190 for ; Thu, 5 Mar 2026 12:45:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772714703; cv=none; b=rtMs+ScStQUUTUE5RUn+XDU/ypeTKrx3GJVZS0CbMK5KPGid6Jh4aaGacMv6dyegt6XMzPjHk/nwmskjV/hFlsbUvh7vOl4VLHamovaUWParH7ndnbM7JL9FBD87GNEF5uYF8Xxwf3NM+rUzlGErRvRviPdftBy6koP176oC/Mc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772714703; c=relaxed/simple; bh=AEsLE3FbYmT8/DFevCckFk6DGQAjaJpQ4yTnvlNJev8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WuttAUoEpBGKvYFNhaiD1WeSPYU/f6AUNCE8VyAisVqVEolSNoieetdLUX0rGmwthg2f6ztRSXnzTUjSYE5InytSoG1ZdbFPd3hxC/Ry9BvzFm3DnRK1i1G+mY6nie5BetE55Ssjs+HnV8k1+tipg7cGgH1lEfRNbDV8KAmmNpM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=HsAPi4dI; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HsAPi4dI" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4836ff58111so84411815e9.1 for ; Thu, 05 Mar 2026 04:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772714699; x=1773319499; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=AEsLE3FbYmT8/DFevCckFk6DGQAjaJpQ4yTnvlNJev8=; b=HsAPi4dItiRbXiDw9ZCcuYCUMm5JJP1LEWImC+ek9Z7oOlsBHPV9HfO/HKVFOkcbJG UU0ceGeQRpkY/WKpnIZyL9LoBs+pYd2xBNFTDYwpeB/3+BQpURvh26d+/0Pk9C6vkfMB H3M1d++J+mQtGZU+dWwNqSLZDdXlsqt0Bo/VXBMkpQBthBb4zzKcXhucMaWqkfRJsjhr P8ofMxcdLzy1viGAMT5FQJa9mEbShwzEFHKYpWoMJ8vzjfZGE5V8KP/M5a+N2H4EsZAX bymnmU7mhw/BCXwpZMA/iegQJADTiwpob2M5XlT/hBPyQjUFh9O4oej055GiNq4srmnm vW7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772714699; x=1773319499; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=AEsLE3FbYmT8/DFevCckFk6DGQAjaJpQ4yTnvlNJev8=; b=WP438FnUdHYD38xVCB5mUOkVqQOaq0sqIWw2TaK3AMUO3e/MU11VxE2E6tqKtAPW/P N0TaOyPfpSs+oDHdUBB/0kbbDoO/rv2bQADSB/aqYo8AwNSAhNUDUwyniZuR0kaY8dvB MV6ULDL4G/giD+GUUYMNJvhNoaOWEwqBV6kbaQfaJLdV+QB1l1f6+1T21UkUBlCoiH5D HOJIjmdmFI/tVBDi6u5jZZnAYhFuzcZx8/Aba+cLak3ygrQDolaQil1kaeb0h3Cp2kfw 6BWCqUfZ+dCukboN5wghkijFZpbMvxNSSHqjct3Vq13aKu2XdiwQG30MRNcxMBy4i7kL ll6Q== X-Forwarded-Encrypted: i=1; AJvYcCW54WofTnbCauYTQYieywNzXnmtljZItheYp+2yD9Lbu4EJBk1vEjKOYCWrdk5fIBR5docLRvY3e0sezDw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2alfxYLVBtbZgp+SmVzYfH/5GI4j38YXQ13AhhxK5ZYMOsL8h 1pu3uq6BA2TIxAkClxUPu07yH38w3zC6B5+6LcxzzxHQ+TGay60mt4n2N5yZNqTDEnTy8a7K2VE RylRMSH1XtbCkGpmbPQ== X-Received: from wmbjj12.prod.google.com ([2002:a05:600c:6a0c:b0:480:6b05:6b98]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1986:b0:45d:d8d6:7fcc with SMTP id 5b1f17b1804b1-48519897a4cmr90895685e9.27.1772714698962; Thu, 05 Mar 2026 04:44:58 -0800 (PST) Date: Thu, 5 Mar 2026 12:44:58 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260224-binder-crate-name-v1-0-7dfc1289abbd@google.com> Message-ID: Subject: Re: [PATCH 0/2] Change Rust Binder crate name to rust_binder From: Alice Ryhl To: Gary Guo Cc: Miguel Ojeda , Miguel Ojeda , Nathan Chancellor , Nicolas Schier , Boqun Feng , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Tamir Duberstein , Jesung Yang , Greg Kroah-Hartman , Carlos Llamas , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thu, Mar 05, 2026 at 12:34:16PM +0000, Gary Guo wrote: > On Thu Mar 5, 2026 at 12:27 PM GMT, Alice Ryhl wrote: > > 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=E2=80=AFAM Alice Ryhl wrote: > >> >> > > > >> >> > > Currently the crate name of the Rust Binder driver is rust_bind= er_main, > >> >> > > but I'd like it to be called rust_binder instead. This affects = e.g. > >> >> > > symbol names in stack traces. > >> >> >=20 > >> >> > We discussed allowing to customize crate names years ago, at leas= t for > >> >> > dashes vs. underscores, for matching C names more closely and per= haps > >> >> > other needs. > >> >> >=20 > >> >> > Back then, we decided to keep things simple to avoid confusion (i= .e. a > >> >> > single identifier used everywhere the same way is simpler, at lea= st > >> >> > for humans) and to avoid having to deal with those dual names > >> >> > everywhere (e.g. adding workarounds for rust-analyzer here). > >> >> >=20 > >> >> > 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. > >> >>=20 > >> >> 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 crat= e > >> > contains #![crate_name =3D "..."], 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 cr= eate > >> > a Rust module where the .ko file and crate name is the same, unless = no > >> > extra object files are linked into the module. > >>=20 > >> I think previously a fixed crate name is load-bearing because we need = rustc to > >> emit outputs to a fixed location. > >>=20 > >> This shouldn't be needed after commit 295d8398c67e ("kbuild: specify o= utput > >> names separately for each emission type from rustc"), so if nothing br= eaks with > >> `--crate-name` removed, then I think it makes sense to drop it to allo= w 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. >=20 > Before this change we rely on the crate name to match the file name, othe= rwise > the .d file and .o file will be placed at wrong location and Kbuild canno= t find > the output files. >=20 > With this change we specify everything explicitly, so even if you pass > `--crate-name=3Dfoo`, the object file is still `rust_binder.o` so the bui= ld can > continue. >=20 > My point is that you *cannot* reasonably override crate names before this > change. Ok I understand now what you're getting at. That commit is required to change the crate name (but it's not required to omit --crate-name without changing what the crate name is). Alice