From nobody Sat Apr 11 08:54:43 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 3617E301718 for ; Tue, 10 Mar 2026 14:53:52 +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=1773154436; cv=none; b=P5t2fPPYcw7bkVBwNy8XOsGDiYUIkM9GiQE+8hWjucI3fOVWAgOVFfIjMAsPIWQIeQmkmNJiU2c4Rk7m9HDWVgNQQFVYX2qDSNYU1Y48/Xq/EfSfnwIKJA3Tupswuq76wggK+d15mz7ytv/6ncCTUM2G+83SDLCJzD+/AdWBeto= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773154436; c=relaxed/simple; bh=4u4fvhIPXB5kgN/ABSv1+b4y6J62ECuYF2r+Uugelr8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uS/o1CvAxlsKUmR3V8KYSSKwzVg5s3cER6No9S+QaPIlzUfv+LvME8BgTv5Ia9fudLBOhyBknpIwmLDBrd2b7SKbX/fpkZRZYuSyNLt7AP4JZgAvtIaPwZLNWc60xnTi0qW63sPKGg8lhnWHhpGpL1XNikPQyKInhn+qbPjQXdA= 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=wm48STF+; 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="wm48STF+" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-485397788b3so25772535e9.2 for ; Tue, 10 Mar 2026 07:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1773154430; x=1773759230; 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=94L9sp5k37zNcDTmcYvp+EilCNTURvypp4H8uEwmm3k=; b=wm48STF+oYtN8Ym1cR3NyFYD8cG/1nD0eHeONn1fLI6OyplfBlF59g0Ww5e2zxP+nB 49cy9Ip8VPO3NxRpGBf3IZ/wkUlzA4bgWJMyS8C3aIek70/EGW0gWJJlgX1XVvEjn3DZ Opi4Qr8lvQ9AhBUCzy5Ck1EQ855nab4mNRcyENyNAMRoJUGongmFognA+DVYtUZEMD4I jkP803Env0CyLsJCo7Cmw4W+7A0P935GkRgvvqiJSI8QT8VY3RNfigg/2xtbhTJnG1d3 cDQaq1EWEAi91G40XqXwkKhe7ZfISbgH0QfL+61Hg295KLOsoUKb5i2LZS8+W7c7yIfs F9HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773154430; x=1773759230; 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=94L9sp5k37zNcDTmcYvp+EilCNTURvypp4H8uEwmm3k=; b=tLaprDcWlm8g3QXkFhy3BrYpq5Ej+18HxA3GZeUFxYbR5k17HRU+ed3s0xjcS+jtKS l+e3Gd1B7AbjhxsF5sehIZK4/6CYMMloJ79GihCgTh+a12nXvS2bLSaDCqH1Ee5XjMYt tuUx/AnP21B2P0UFD1snm/a1tovrjcnpmsoexuwzStNor96EwEL7sMGUOTI2OHGOBs3Z Vnjwk0vGOt8GoE/xaY1RKKx7oonQ/3/tZ+tFDB1cneR6q8O34hssjPVFbn3F1bbnkqxK D5Ndfx5xyZ3Dh+A2msQKWiOjiOvwufORdFSEpxXZJuq1cl4RYo8flrOI6BvNil3+TLCo J96A== X-Forwarded-Encrypted: i=1; AJvYcCU80QILU/zk83g3N+zGGjzZRKENHsc+bIsol7MuYuhUI3UR2D8F155CTGxbZnWmDcrEseJrqNJtScdUrdg=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7VYow+HBvBZIWRfM1eaNFlmztzC9O3qMvFBwP5qfISOCHmnSQ bWzzdUKJT5APQq62pv7ToSuu59Ey0IIH+zt49JiV0vyfsnayyQHOIr6ybLT3FmTRzoMUXLFg07o UoxrQso20CpgsvxE8LQ== X-Received: from wmcu18.prod.google.com ([2002:a7b:c052:0:b0:485:29a1:bfbb]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:c094:b0:485:3f17:425 with SMTP id 5b1f17b1804b1-4853f170524mr89679585e9.21.1773154430332; Tue, 10 Mar 2026 07:53:50 -0700 (PDT) Date: Tue, 10 Mar 2026 14:53:40 +0000 In-Reply-To: <20260310-binder-crate-name-v2-0-0f7c97900d36@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260310-binder-crate-name-v2-0-0f7c97900d36@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=3022; i=aliceryhl@google.com; h=from:subject:message-id; bh=4u4fvhIPXB5kgN/ABSv1+b4y6J62ECuYF2r+Uugelr8=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpsDB7GkmnDRMzOeFUAB53R+gB52QijKuyS43tu a2O1BemiWmJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCabAwewAKCRAEWL7uWMY5 RtN5D/93HcSbicvwB/z25I9ulnaEtffRUX9jVoyA6vf2xxBcJ1Ul2exM6MmQgUAUCe5Itp78qls Fw0n3T8PDNq+7+VY2hCIMAfKOXA+DHAufPfAdJMydNeWEBZriF8kMbZtuXCLcYBnae5vYJiGnr8 TCbD/Ch9IxX2xNqwiEmJ6iIZEnL0gcY2gfzUxl7HwBVcxyWQXSd8UTeDFOaos/DR3KTWT3ZMZ2B u9rxqqFit6SqQvIDh7w7tp8FV2v7qkkAZZSpC7PvLdRpQ5kNCl5Jowa6le75SPg4P4nLW9Stvyp lRGiTnZ7zYCml+/2ug0OB+J/PqgNwXycSe47CRAmYG9sYwCaLwL/6iuABdfVwzLH3OPntb0zQA4 9sBh0Nj+Ek4uIl4/FrQr+jjuBNZ+lGztmh0pO4ycUCKj/eVNLMEljhCjQCop4I99YjlLQzAapIo MW14P+tEPxT5IoD2LFOkuLCTwHizxztGBcJqOPhSP6L5VgGUuu4U2ILulE+H6hJJfWxX4RixO87 wvKmkA8v/STXT1S1gFikyjmaB8hhQirCoIE0aNrE91RM1hA9849qM87SKibhK0qPtMM6phl1dMy IYPEqDeacZ+q2CgqpT3rc0U3aI5LbWrYqKaVcDrm3bgF1Plz0yzwYFNSzzw6ZNy9N+h2N/I4Zkz 95irDktEr9uSb2g== X-Mailer: b4 0.14.3 Message-ID: <20260310-binder-crate-name-v2-1-0f7c97900d36@google.com> Subject: [PATCH v2 1/2] rust: support overriding crate_name From: Alice Ryhl To: Miguel Ojeda , Tamir Duberstein , 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 , 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, remove the --crate-name argument for drivers. This allows them to override the crate name using the #![crate_name] annotation. The --crate-name argument is kept for the crates under rust/ for simplicity and to avoid changing many of them by adding #![crate_name]. The rust analyzer script is updated to use rustc to obtain the crate name of the driver crates, which picks up the right name when it is configured via #![crate_name] or not. Note that the crate name in the python script is not actually that important - the only place where the name actually affects anything is in the 'deps' array which specifies an index and name for each dependency, and determines what that dependency is called in *this* crate. (The same crate may be called different things in each dependency.) Since driver crates are leaf crates, this doesn't apply and the rustc invocation only affects the 'display_name' parameter. Signed-off-by: Alice Ryhl Acked-by: Gary Guo --- scripts/Makefile.build | 1 - scripts/generate_rust_analyzer.py | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 32e209bc7985..adc3e2d1ac78 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -332,7 +332,6 @@ 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 $@)) \ --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..d25bc3d7e719 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -194,6 +194,12 @@ def generate_crates(srctree, objtree, sysroot_src, ext= ernal_src, cfgs, core_edit except FileNotFoundError: return False =20 + def get_crate_name(path): + return subprocess.check_output( + [os.environ["RUSTC"], "--print", "crate-name", path], + stdin=3Dsubprocess.DEVNULL, + ).decode('utf-8').strip() + # Then, the rest outside of `rust/`. # # We explicitly mention the top-level folders we want to cover. @@ -212,7 +218,7 @@ def generate_crates(srctree, objtree, sysroot_src, exte= rnal_src, cfgs, core_edit =20 logging.info("Adding %s", name) append_crate( - name, + get_crate_name(path), path, ["core", "kernel", "pin_init"], cfg=3Dcfg, --=20 2.53.0.473.g4a7958ca14-goog From nobody Sat Apr 11 08:54:43 2026 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) (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 BAABE3064A0 for ; Tue, 10 Mar 2026 14:53:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773154438; cv=none; b=X5YZM59B++jh0AkzOQMpkoT2plO1zHwXbo/NEAUt8Abt2Qpac101fuvocd1AgpElgaEWium4920MVPz9vqpd53V6iMtB2Ja66fqx+Q3bpEHS9WIFx9cZJY4Zc/5xjdd/f7Z8kyg5J+XmEcnU2bSQ5RARt9ogBWAIZDznhO780Dw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773154438; c=relaxed/simple; bh=cY6DKEz6B6F9rSWVgqrMMhttMqGc5V6Xd0spRFKA5+0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=OioAPrxdZ4KdYVSnyq7xRdhZyLkUV8sSQRfl/nWnYPOrkA69yoDY7fHACP1Bg2+oHF0OgRqEckfqWm8jMEwNxKtOJ4HwAQeKkc0Qq1oXOL7KixsL1LZfhetGIT2Gj+wrPnhpdyeWEKWvtBrH9wSqDW3SfRJYH+yNclDJkpEg9N8= 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=ZG3zkdFT; arc=none smtp.client-ip=209.85.208.73 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="ZG3zkdFT" Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-65a11b5f24dso13981684a12.1 for ; Tue, 10 Mar 2026 07:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1773154432; x=1773759232; 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=LXxRsUcVZGooITxYkuZC3aEN++rGhCtcSjN37MU6sY8=; b=ZG3zkdFTdLn2A8uGkkKpKvmVvXjkJc9z+lKfHHNsKBjRAkSEQLgII8K8RzarRzlIMh hwGp/mxVrxmWL1gICJe4qlZkR0R0WrsPwF7c9OrDCnAcR3OGPJHuWfrG3C3wmJm303oZ 0XitoHyHNCLX6NlGL/H6UUd0TUvRyGUmVfVT6CHjzvsBR+Dt0vGzrnhzUS8MJH3PCOG2 etuzwCzk08KL8JPrLgSUidAocl0fR4D6IV36rJBSP9WeSWMCd2xGJyOFt4hQvhO2aS+O OBK3jkKFeRFIrjxZ2dP5nEfIyslUrpM6u5HlzyW4gEG06EFaAdV2GVoH7MWuPgOpXrPv hVvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773154432; x=1773759232; 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=LXxRsUcVZGooITxYkuZC3aEN++rGhCtcSjN37MU6sY8=; b=mZeCpHFIPTqkei46B23ntMx46ld/McvH1W5M7+Ep2mg+HIORPaZhX2FyG8jQ8V3IL0 tZ8F+7bnbcnmng+xOkAHU7EqzLtD8xqkI57bq2NAJS25+Jj9Vz7kKIZwHkFK/j5utmDH nrDSqHbfDTrqFBGRqXycRKrKDs36uAzSQ2ZPr5kK/D4Fy5QrI8GEmpjBnsM4AOmAf2+v GDTQ8iyYL81dWkaNwOuQ7h7GQCJDQK+mHFShRK2H5BpCHTZMHs7ihqPwXEEj1EVnswlO ZBR1PHe54UVbfad2443xL91b/w8gABI3ESK5JwUyjqnD4OwlWzK1TyLAFjFjlIMvLpxV wjgQ== X-Forwarded-Encrypted: i=1; AJvYcCVJuzI5a2drOReXGXnCzZCyNj359i52vTieM2hZ7VjOyC160cAWaodtR31cg3xTIElj30V49RPaAZRIPDQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxaiOaX6ZIAtfsmgRFanaEsS5MJNksKLPt+DoVCkvjzrFnbSGnZ pxRtcjbZae+LhGlwRpVM4a7mqDpZREqg7hiJl0zIRX118MTb1ZXvLt67frp80HN6Q55Xf2iqaPg jhR94SFvlCQmVxb4bXQ== X-Received: from edbgy4.prod.google.com ([2002:a05:6402:5bc4:b0:662:d4e3:3c3f]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:5297:b0:65c:5def:26f2 with SMTP id 4fb4d7f45d1cf-662ba75c08cmr2251051a12.11.1773154431614; Tue, 10 Mar 2026 07:53:51 -0700 (PDT) Date: Tue, 10 Mar 2026 14:53:41 +0000 In-Reply-To: <20260310-binder-crate-name-v2-0-0f7c97900d36@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260310-binder-crate-name-v2-0-0f7c97900d36@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=950; i=aliceryhl@google.com; h=from:subject:message-id; bh=cY6DKEz6B6F9rSWVgqrMMhttMqGc5V6Xd0spRFKA5+0=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpsDB7jo28XWHraaIbZEs4ZPiy/1gjlkLBiQ/rz rz0Yb0G+XyJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCabAwewAKCRAEWL7uWMY5 RmUwEACQk9pcbTkR4VN+emXNH4WS1qlo1JojOLfRikbe8ojkFYZm2BZbxG26HFPzMVV+1FnpndX O1unZmK8CcGYNYGk080M41kDzqgpfgW8aoM4yvwmEJbFTvec7I6r8vuXf18aRrQSdPK7CfhVxtc BSHYd0aTmhoG1lyvfE3PeW9Aa65hlTpYLPdQWKqcutopqBvEphxDaixoFKme06L4u8Q6vZga23z DNMLw+2o/XEIP8J2a6q1Z/0JLi3FY5RJu9vDQliw+6qBCx/27SjZigcTdVz8XCNgz2Cju/QI7GR Ju/WLkcjKQaY93xN36FJlaIPZjk0synEAC5bBsWf/cHNMhtsQUfzff5FIojrPSDTdabifRgQ+rY 2Dp4uUPf+XFhJFCtTePv+rD3M677OR2aMfE7baMLnUBqYxn+dJezj2UNrUvK5j8YU0ROfDeovIZ t08DmScIf6s9yvT38uIXQrbLITN4UE6s++Cq1xHuNkHY3FyquLohKUlXSfmeEY9eBcpvU4v97Rj kdAIJW2JFVytog4ICUz9J6iQ1OGbVQtG/NXnNUZjVsEIn5xNLB5VVHV5a3NE+f3utJ5SDmHGmLl tC6KvoUyWmZEDNLsK5N88GQ180bdz1agD7tFjZb//49fD7UTuGKIPsWLRMtyIZx7Yk7ZS/JPWgc L/PQNYIbYDypoxA== X-Mailer: b4 0.14.3 Message-ID: <20260310-binder-crate-name-v2-2-0f7c97900d36@google.com> Subject: [PATCH v2 2/2] rust_binder: override crate name to rust_binder From: Alice Ryhl To: Miguel Ojeda , Tamir Duberstein , 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 , 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/rust_binder_main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/android/binder/rust_binder_main.rs b/drivers/android/b= inder/rust_binder_main.rs index aa5f2a75adb4..14162af0f5a5 100644 --- a/drivers/android/binder/rust_binder_main.rs +++ b/drivers/android/binder/rust_binder_main.rs @@ -2,7 +2,9 @@ =20 // Copyright (C) 2025 Google LLC. =20 +#![crate_name =3D "rust_binder"] //! Binder -- the Android IPC mechanism. + #![recursion_limit =3D "256"] #![allow( clippy::as_underscore, --=20 2.53.0.473.g4a7958ca14-goog