From nobody Tue Feb 10 00:59:24 2026 Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 989301A38F9; Tue, 30 Dec 2025 16:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767113344; cv=none; b=PUog7xLQSMuXYT3Vt8B+NZl/quv8dU6eaRPz3o/xVmFQivnnH6j+JPXl+IiWK8+yufcm1L+CjQAELkfXPUunEv5Z8e1EBJfVedUnRRPoBH35/LNRpeSUgerEJVj+AV6bVlVYRkcuSzh/d2d+jTRzcqIbtpfXp+zul4gI6rrs+hg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767113344; c=relaxed/simple; bh=V92+XaWbFZRmONdWfp1uuKCRVh275bDIqbcoKn+Fs7Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UlFPaeaKp/cKXvoOtIr5h1Q8HK8iHRXEa1utftFt+yDWlE+TJtjTsWruFYFtKygPLcGifZmJKNEKEvjAnWlnRlje3zqRThx+Vn+revAnCnwCB1qC0TgcD4NtVFuYxtvBNSylwfXzQqrGPAhlXHG7m5PbOJd3w0KVxarYytQqexg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=isrc.iscas.ac.cn; spf=pass smtp.mailfrom=isrc.iscas.ac.cn; arc=none smtp.client-ip=159.226.251.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=isrc.iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=isrc.iscas.ac.cn Received: from minun.felixc.at (unknown [65.108.105.71]) by APP-05 (Coremail) with SMTP id zQCowAA3yQw8AlRpUjKQAg--.63740S3; Wed, 31 Dec 2025 00:48:19 +0800 (CST) From: Asuna Yang Date: Tue, 30 Dec 2025 17:47:54 +0100 Subject: [PATCH v6 1/4] rust: export BINDGEN_TARGET from a separate Makefile Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251230-gcc-rust-v5-v6-1-2ac86ba728c8@isrc.iscas.ac.cn> References: <20251230-gcc-rust-v5-v6-0-2ac86ba728c8@isrc.iscas.ac.cn> In-Reply-To: <20251230-gcc-rust-v5-v6-0-2ac86ba728c8@isrc.iscas.ac.cn> To: Nathan Chancellor , Nicolas Schier , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Nick Desaulniers , Bill Wendling , Justin Stitt , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Jonathan Corbet , Conor Dooley , Mingcong Bai , Han Gao , Vivian Wang , Jason Montleon Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, linux-doc@vger.kernel.org, Asuna Yang X-Mailer: b4 0.14.3 X-CM-TRANSID: zQCowAA3yQw8AlRpUjKQAg--.63740S3 X-Coremail-Antispam: 1UD129KBjvJXoWxXF4xXFy8trWUWr18ury3urg_yoW5Ar4xp3 ZY9w48KFW7JrWrKr4rCr45XF1UKw15t390gFyIqw4UJrW0kr4IqFZakrW3AFWfurWj9ryY gw12kF93CrWUC37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUQEb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6r1S6rWUM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI 8067AKxVWUGwA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF 64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWUJVWUCwA2z4x0Y4vE2Ix0cI8IcV CY1x0267AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVWUJVW8JwA2z4x0Y4vEx4A2jsIE c7CjxVAFwI0_Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c 02F40Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE 4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4 IIrI8v6xkF7I0E8cxan2IY04v7MxkF7I0En4kS14v26r4a6rW5MxkIecxEwVCI4VWUMxAI w28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr 4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVW8ZVWrXwCIc40Y0x0EwIxG rwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWxJVW8Jr 1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvE x4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07jz-erUUUUU= X-CM-SenderInfo: x0lq233loux21fy6x21ufox2xfdvhtffof0/ A subsequent commit will add a new function `bindgen-option` to `scripts/Kconfig.include`. The bindgen backend requires the `--target` option for cross compiling, but variable `BINDGEN_TARGET` in `rust/Makefile` cannot be exported to `scripts/Kconfig.include`. Therefore, move this variable to a separate new `Makefile.rust` file and include it from `scripts/Makefile` to make the exported variable available for use in Kconfig. Place the include in the `need-compiler` branch to avoid including it in irrelevant make targets. Since the new file name is `Makefile.rust`, it matches an existing MAINTAINERS rule `scripts/*rust*`, so no modification to the MAINTAINERS file is needed. Signed-off-by: Asuna Yang Acked-by: Nathan Chancellor --- Makefile | 3 ++- rust/Makefile | 8 -------- scripts/Makefile.rust | 9 +++++++++ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 27ce077520fe..9754d7add947 100644 --- a/Makefile +++ b/Makefile @@ -718,9 +718,10 @@ ifneq ($(findstring clang,$(CC_VERSION_TEXT)),) include $(srctree)/scripts/Makefile.clang endif =20 +ifdef need-compiler +include $(srctree)/scripts/Makefile.rust # Include this also for config targets because some architectures need # cc-cross-prefix to determine CROSS_COMPILE. -ifdef need-compiler include $(srctree)/scripts/Makefile.compiler endif =20 diff --git a/rust/Makefile b/rust/Makefile index 5d357dce1704..2603b34f9833 100644 --- a/rust/Makefile +++ b/rust/Makefile @@ -385,14 +385,6 @@ bindgen_skip_c_flags :=3D -mno-fp-ret-in-387 -mpreferr= ed-stack-boundary=3D% \ -fzero-init-padding-bits=3D% -mno-fdpic \ --param=3D% --param asan-% -fno-isolate-erroneous-paths-dereference =20 -# Derived from `scripts/Makefile.clang`. -BINDGEN_TARGET_x86 :=3D x86_64-linux-gnu -BINDGEN_TARGET_arm64 :=3D aarch64-linux-gnu -BINDGEN_TARGET_arm :=3D arm-linux-gnueabi -BINDGEN_TARGET_loongarch :=3D loongarch64-linux-gnusf -BINDGEN_TARGET_um :=3D $(BINDGEN_TARGET_$(SUBARCH)) -BINDGEN_TARGET :=3D $(BINDGEN_TARGET_$(SRCARCH)) - # All warnings are inhibited since GCC builds are very experimental, # many GCC warnings are not supported by Clang, they may only appear in # some configurations, with new GCC versions, etc. diff --git a/scripts/Makefile.rust b/scripts/Makefile.rust new file mode 100644 index 000000000000..5c12b4b8c8b6 --- /dev/null +++ b/scripts/Makefile.rust @@ -0,0 +1,9 @@ +# Derived from `scripts/Makefile.clang`. +BINDGEN_TARGET_x86 :=3D x86_64-linux-gnu +BINDGEN_TARGET_arm64 :=3D aarch64-linux-gnu +BINDGEN_TARGET_arm :=3D arm-linux-gnueabi +BINDGEN_TARGET_loongarch :=3D loongarch64-linux-gnusf +BINDGEN_TARGET_um :=3D $(BINDGEN_TARGET_$(SUBARCH)) +BINDGEN_TARGET :=3D $(BINDGEN_TARGET_$(SRCARCH)) + +export BINDGEN_TARGET --=20 2.51.1