From nobody Fri Apr 17 01:44:06 2026 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.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 39B9F36CE0F for ; Tue, 24 Feb 2026 09:38:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771925926; cv=none; b=AVaEsOexyTYVTMfyDDNhHcNnMagBKPtLw5+Jtu03/0leZeke0rQwfifzHF0V+zglpiNJJTsqpSY7MwB/4SJNbVCYkIRyihX/NqG/Amka85Z2GiHt6NVPmUfU2/D9Iv2AgURkhLj61hpCanCuXWKNTxXdTqZWvNGeTfXSSLrY6ek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771925926; c=relaxed/simple; bh=oBt0IdxnnhkZ0g5np5ZbxHi8G2tHQUQMowfTi1g3uy4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=QSJdTVHLKORfDtDysfqTVWWQkZ6VQAp9riQkMOHsW9Oi+s3C4Vt45uEX1mpnpyl/odxgo1h1vjuw4I4vb4/ADIfeK1xX4/rbYTJhX7pXm1olKiSvL30CocOAtFz1xrijeLXu3DYe0+UND2lZM6irctpptvD7Dqm0gxp3beYybHU= 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=QDqfC4Nn; arc=none smtp.client-ip=209.85.221.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="QDqfC4Nn" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-4376ecafb7fso3572377f8f.2 for ; Tue, 24 Feb 2026 01:38:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771925924; x=1772530724; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=YmoyykDD/w79A51QbLaUJSobDaeNleJFCFG+lFijE94=; b=QDqfC4Nn+T8qXCY+QJGyl55/R7khA95shBOFwkwXThS9tZ043fY8hn0h6Mw6qOGkuL dLxpI+jnajcfvfZKHXOaS9zm+CNGqxTd2XwFQW/NRa4QXbSFRPiiC6M6LBC4vL+l9LDK p5rXhY9Umf1pB+pS+5aczfbeH3IiUKjsC6SlzPFK8JfI34t73nZLRzmPntsEM3/SW+lX yLeCVg8Ww6NkBuGkJC31e6kQPppbJQny9o0Z4h615vAKlsC0OQwhrlg5aR9rtlmVKdFW 3myKBAvjL6MaYvPtJ4B8kz8gzWUjmShIRmJF+6E1U81nprKVCnATxr57Euho3QxSZBxQ wtNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771925924; x=1772530724; h=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=YmoyykDD/w79A51QbLaUJSobDaeNleJFCFG+lFijE94=; b=b13d02wFEIobWRLCMCzyndER0Eywk/heNccKIjrtCVjLSiMshmLhAXcqzIuFdTMNx6 KB9xOo5QJ4gi8bieC2IYX+9VdTkiwMlbW3TvPt3VC97mUAhk2ATUheC6KQo/alOCeQRE 6glYc8Hd1Qemq2Qnof+NVFAoy92fGZAYiHtA95e/YoLPskXs3cr7gOLXrDOPML5JA+zn JWxArl4JeifXCWc145XreokSKQFSoIvxvl99rwDzVZh9cfphzrennBSNOvqvStfxmKlV tCLte/VlEzJ6kRlZF3YKs1yCra4UtzwYf/Sww/3d97nmYlA1lJjsVfWazItrFRkLvmKf ucFw== X-Forwarded-Encrypted: i=1; AJvYcCVmQBq3sezpc5+CyUUsE+ffLqE0MTpGmq5ix6F2/igKtL2CvAIT7CszMmX3IywNn3jLNrRU0Ew0CoeXfeM=@vger.kernel.org X-Gm-Message-State: AOJu0YzKuyjtx8L/zNEQZTc1Mqzt+mO2S5UZ+NPplMqlAOWNdG7wBIC4 uu6dIq3ZmFkts9buFiLwSu7j1W58Jw8OA9QD3j8dfUwl/uZ3pyHycMFBOFzeyYS/6gB5j6u55YK ZsdKHEf1Xn3Mfqnen1Q== X-Received: from wrs7.prod.google.com ([2002:a05:6000:647:b0:437:6efb:7aeb]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2f86:b0:437:6efe:94d2 with SMTP id ffacd0b85a97d-4396f153ad3mr21312440f8f.4.1771925923605; Tue, 24 Feb 2026 01:38:43 -0800 (PST) Date: Tue, 24 Feb 2026 09:38:34 +0000 In-Reply-To: <20260224-binder-crate-name-v1-0-7dfc1289abbd@google.com> 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> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=3626; i=aliceryhl@google.com; h=from:subject:message-id; bh=oBt0IdxnnhkZ0g5np5ZbxHi8G2tHQUQMowfTi1g3uy4=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpnXGg+OFAFDTnKGgsZqWB1MwWC8UuwCbFwr/ts WNfNaPSF3uJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaZ1xoAAKCRAEWL7uWMY5 Rh1GD/wNg0UPr1FuQf+jaIunm5aG6ARiukRF5Na8zpJCOCV1zXRCShTNJdm8gRhUCVw07pvhRYw ub7bN3BYYpewPWP7EbRujQ9iIejp/WInXwiszB1hwJBOiCG7ENB/SN6kFm3Djrx4NlUfvCYPOs0 8SsLS4o2Sv0NOl5KjKfaR+FKBGPCqJQzEDJ15txwBeve1g7/TAK6cEk/Z3zU7WbCdq1Jz7JuP3S r+Rw6IhwKnFrjU6/t0p1GBsqSg3LAkXO89l5RXTRYiIHPf2pCs0w/erSIcEJZ7J6kNQCB8DYNsG uZRp8Hi3MrUzDR+W/0OGtnZnkrxmMX9MWY4axsTnQzkEv4jwa7nIDrUyf30O+wTh83tK9IKnBY/ wCHlrJULnlN8fQ6sy4qAHsemDvs9pSyzi7f68pjYzZNwU8B679WY1nt/T7Rq9m7CMGC4J8S2wRN o/bcUMb/xvrtJ/AhR1C0aRe7US7Z3fBuHQldUEm/5mo3N6cXkLe4MVzcb8Mp66ACd2Vpdc49xP3 KOTBcPjddmEmdGc3Un7FAgITm5OPXxu20uKoFze2GNGAyLUbrzGcAMg5FF1HWiOAn1AH2RR77WC 5HxUPGMiKVoIeaECC7UwrhYnSPDYy5KK6S8mhtLrTVqfY1lBUmSyzYtzPTOSVXPA4Pl3LOX8i14 Lv8PbsTxdB8ERXg== X-Mailer: b4 0.14.3 Message-ID: <20260224-binder-crate-name-v1-1-7dfc1289abbd@google.com> Subject: [PATCH 1/2] rust: support overriding crate_name From: Alice Ryhl To: Miguel Ojeda , Nathan Chancellor , Nicolas Schier Cc: Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_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, Alice Ryhl Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Currently you cannot filter out the crate-name argument RUSTFLAGS_REMOVE_stem.o because the Rust filter-out invocation does not include that particular argument. Since --crate-name is an argument that can't be passed multiple times, this means that it's currently not possible to override the crate name. Thus, add a RUST_CRATENAME_ option to make this possible. The logic for getting the crate name in generate_rust_analyzer.py is a bit hacky, but I'm not sure how to do it otherwise. Signed-off-by: Alice Ryhl --- scripts/Makefile.build | 4 +++- scripts/generate_rust_analyzer.py | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 32e209bc7985..dea8320e5bde 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -324,6 +324,8 @@ rust_allowed_features :=3D asm_const,asm_goto,arbitrary= _self_types,lint_reasons,of # `--out-dir` is required to avoid temporaries being created by `rustc` in= the # current working directory, which may be not accessible in the out-of-tree # modules case. +rust_cratename =3D $(if $(RUST_CRATENAME_$(target-stem).o),$(RUST_CRATENAM= E_$(target-stem).o),$(basename $(notdir $@))) + rust_common_cmd =3D \ OBJTREE=3D$(abspath $(objtree)) \ RUST_MODFILE=3D$(modfile) $(RUSTC_OR_CLIPPY) $(rust_flags) \ @@ -332,7 +334,7 @@ rust_common_cmd =3D \ -Zcrate-attr=3D'feature($(rust_allowed_features))' \ -Zunstable-options --extern pin_init --extern kernel \ --crate-type rlib -L $(objtree)/rust/ \ - --crate-name $(basename $(notdir $@)) \ + --crate-name $(rust_cratename) \ --sysroot=3D/dev/null \ --out-dir $(dir $@) --emit=3Ddep-info=3D$(depfile) =20 diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_anal= yzer.py index f9b545104f21..4126acdc03ec 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -8,6 +8,7 @@ import json import logging import os import pathlib +import re import subprocess import sys =20 @@ -194,6 +195,16 @@ def generate_crates(srctree, objtree, sysroot_src, ext= ernal_src, cfgs, core_edit except FileNotFoundError: return False =20 + def get_crate_name(build_file, target): + try: + contents =3D build_file.read_text() + match =3D re.search(rf'RUST_CRATENAME_{target}\.o\s*[:=3D]+\s*= (\w+)', contents) + if match: + return match.group(1) + except FileNotFoundError: + pass + return target + # Then, the rest outside of `rust/`. # # We explicitly mention the top-level folders we want to cover. @@ -206,13 +217,17 @@ def generate_crates(srctree, objtree, sysroot_src, ex= ternal_src, cfgs, core_edit name =3D path.name.replace(".rs", "") =20 # Skip those that are not crate roots. - if not is_root_crate(path.parent / "Makefile", name) and \ - not is_root_crate(path.parent / "Kbuild", name): + makefile =3D path.parent / "Makefile" + kbuild =3D path.parent / "Kbuild" + if not is_root_crate(makefile, name) and \ + not is_root_crate(kbuild, name): continue =20 logging.info("Adding %s", name) + crate_name =3D get_crate_name(makefile, name) + append_crate( - name, + crate_name, path, ["core", "kernel", "pin_init"], cfg=3Dcfg, --=20 2.53.0.371.g1d285c8824-goog From nobody Fri Apr 17 01:44:06 2026 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 359E736E463 for ; Tue, 24 Feb 2026 09:38:47 +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=1771925928; cv=none; b=D+H9xaIuUMvSGR188wPvR2G/2W12DsazndOP+Z/xLtTKH0rDGgTHLe33RXL5K/ZsjecGeG31JjprFZpDTPIDTCRSehXafPQgaRMTgVBkj5IVxqdBjVDJoAoomlMqVcGUPCZMKAMtuCZJN5OKq5EPkxxBDFaaYnHv2OtENMoo/xQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771925928; c=relaxed/simple; bh=Xk1lDWd9IQaBWIMxmn2RwMmtIq2UAwQ7MWxTqEsVdBE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=m/lz27PhjRC1nT4LMg/IT31VE37C7DTg6fd8MOoQWg6zFauih0ZESLU17VCeNbRxspfhhwC+xCQIRdkOc+jkVLm9w4rMTwMNz9Ebkrv/h0Vpkv5e85DSIKD/tv44Jh5l9i04OhbpBZ09W034B7In6LOKIMDDxo4CATe/8AlAwvI= 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=uYXwL/MP; 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="uYXwL/MP" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4836cc0b38eso6728455e9.2 for ; Tue, 24 Feb 2026 01:38:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771925925; x=1772530725; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=8m9A/BV1y8Vavv6XG6dMjjtiowo5GrqxiUU8his8Dn8=; b=uYXwL/MPX+wVumXSgP5T10yeSG7cafH6N7HaPYBVMsqkWhKiKrEtbrIAdpc6moJEry EKt3BGX/W4BHY86HxRUFgkZwyknfakWneP/PYenLlGb5RKQkijJ/3cHrgZmkRSRFChkl T1SpKu5zewdHv4sYkV8lZIOW60hmQpVSDece40y41HUVjXfoREVrlAo1jfnlGXVP7/a0 dzCHLawOLhezXlBpZnOAp6fDMucMvEpzvg/q5E68otH4EOC+Q2Jk60vmfOjLrWPj4CKy +ghEF4pkAxk4O3D/mnEGCnioL5XDqByyyH2hzLIu8V6Aa7WF2+mo2bsdFShe2pLh/5dF MAxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771925925; x=1772530725; h=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=8m9A/BV1y8Vavv6XG6dMjjtiowo5GrqxiUU8his8Dn8=; b=Bofgkk5qXwpWjvgKFrt+mm2Bq1SKh3SdKA/7f6lIyY+jtBEeMCzYc3dvAkymOKoqf8 dNwY7gt7kMYMdN4rAAnlR5dL+OX7KpJj0nOJDwWj1CrKTs5Ikjh9VLZ/F9bHctd9G8Fk AF+kQiYITURO1wZP4VnF/oWqI2AC4DPZ5537jtKjt28yDq2B9/i4xClwEikHxgIFdL5y 76cKVszNJCEC+T/aMcivIwTCNYyrDg36a47YkC5m33FpVhK2SztGoAKpYxCGLwW3vhpb K4Aag6E80bYiKWVMuqr15EdN7ADfmZv3ICC69l42GISvBxBQOxOV3jT9q4q4p+n/odQT Cg6Q== X-Forwarded-Encrypted: i=1; AJvYcCU0Jz+s1XnLvvvJ6NiT7B4BXmSir9t2l49nfVz0bTj1X2DWbh8SISe0Zt3B04X+fAnMVIAShVaaOsUzsCU=@vger.kernel.org X-Gm-Message-State: AOJu0YzQosxCrRpZtPObdvMVuOtVzP85wnHADhblPNdnMEDD4n4KyOTi OmhmmXsxmfKSc0sSHOCSppC83hRn7U7jA8+bkr1hefHutymQQRwDHrR66d8eCdnN+BD/8qRMOY6 gL7eN6xEzRBxZ2zT82A== X-Received: from wmcn19.prod.google.com ([2002:a05:600c:c0d3:b0:483:6ff0:11a0]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1d19:b0:477:abea:9028 with SMTP id 5b1f17b1804b1-483a95a9d86mr190052735e9.6.1771925925179; Tue, 24 Feb 2026 01:38:45 -0800 (PST) Date: Tue, 24 Feb 2026 09:38:35 +0000 In-Reply-To: <20260224-binder-crate-name-v1-0-7dfc1289abbd@google.com> 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> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=949; i=aliceryhl@google.com; h=from:subject:message-id; bh=Xk1lDWd9IQaBWIMxmn2RwMmtIq2UAwQ7MWxTqEsVdBE=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpnXGgT/q485BYjVEC7DcdrjqoPaon4Mtheaj2e ttnkPM05+2JAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCaZ1xoAAKCRAEWL7uWMY5 RiqDEACnMUi2b4SBivjWw1SCmDjUa1u/aDm2uVSHI6BawvC57Z9WNQwuzy/RdcBTdPLsBzzjBuR PS8jLpIbAnPcjnccRfzV6xd9zf4CsziPjhkdFcxDKfo+l68IRV8Ikim//IQLtYBa4QwdmYMrvcF /2irISdDfqugsEuOryJcEohlouYmumtaH39VoXvBvEgt+PSKJEa8EpxzQepb/DyIhoXpFatgrju /z+PNyGNHjySE9FPNP0VEJoa7J3+Q4xrX8UB/gHwk8Ze5kaiZncleM2T0qwk59tKHdaQGJj3qMt BGhHkI2lpVAgM+hpFJCbSKjEK/lkwM5Zqrnpk/ECBPeWuzH5L2Cfa/txdDAJlV7tFFlUEK5jb/a 5EBdgHUr2hR4jZEUcPqjFpPhjZ/cIoExfuRkZnyLZ0ob3spRgOxhZ3933qA/YXRymeGujZom4d5 L/Xs3219iSVZx472EBx9Upnol8KCIsoxft2F+j1YoLj82HopVfY6kxL7eOAZAp1CsurJsklFAjJ DNyBlRthXnF8orEQafEJRSK0kjWeFjCvvP2WSq+9oakah4THzAdR/fsuhhHSRpE0GUxHAhhFptj MAWQux3YtlyJ1M3T+Bfyx507HjjFLtMfxFA7pDcQe9w0Y/HINt/+j3VVoUJ8jJeY/RvfVeZQvAL LLz0jrN9cZwSSbQ== X-Mailer: b4 0.14.3 Message-ID: <20260224-binder-crate-name-v1-2-7dfc1289abbd@google.com> Subject: [PATCH 2/2] rust_binder: override crate name to rust_binder From: Alice Ryhl To: Miguel Ojeda , Nathan Chancellor , Nicolas Schier Cc: Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_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, Alice Ryhl Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The Rust Binder object file is called rust_binder_main.o because the name rust_binder.o is used for the result of linking together rust_binder_main.o with rust_binderfs.o and a few others. However, the crate name is supposed to be rust_binder without a _main suffix. Thus, override the crate name accordingly. Signed-off-by: Alice Ryhl --- drivers/android/binder/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/android/binder/Makefile b/drivers/android/binder/Makef= ile index 09eabb527fa0..a28d737d27f4 100644 --- a/drivers/android/binder/Makefile +++ b/drivers/android/binder/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only ccflags-y +=3D -I$(src) # needed for trace events =20 +RUST_CRATENAME_rust_binder_main.o :=3D rust_binder obj-$(CONFIG_ANDROID_BINDER_IPC_RUST) +=3D rust_binder.o rust_binder-y :=3D \ rust_binder_main.o \ --=20 2.53.0.371.g1d285c8824-goog