[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251204-gcc-rust-v5-v5-2-2d4f20d86c24@gmail.com>
Date: Thu, 04 Dec 2025 08:54:52 +0100
From: Asuna Yang <spriteovo@...il.com>
To: Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nsc@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
Paul Walmsley <pjw@...nel.org>, Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>, Alexandre Ghiti <alex@...ti.fr>,
Jonathan Corbet <corbet@....net>, Jason Montleon <jmontleo@...hat.com>,
Han Gao <rabenda.cn@...il.com>, Conor Dooley <conor@...nel.org>,
Vivian Wang <wangruikang@...as.ac.cn>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, llvm@...ts.linux.dev,
linux-riscv@...ts.infradead.org, linux-doc@...r.kernel.org,
Asuna Yang <SpriteOvO@...il.com>, Asuna Yang <spriteovo@...il.com>
Subject: [PATCH v5 2/4] rust: generate a fatal error if BINDGEN_TARGET is
undefined
From: Asuna Yang <spriteovo@...il.com>
Generate a friendly fatal error if the target triplet is undefined for
bindgen, rather than having the compiler generate obscure error messages
during the build stage.
This piece of code is copied from `scripts/Makefile.clang`.
Before this commit, error messages might look like:
error: unknown argument: '-mno-riscv-attribute'
error: unsupported argument 'medany' to option '-mcmodel=' for target
'unknown'
error: unsupported option '-march=' for target ''
error: unsupported option '-mno-save-restore' for target ''
error: unknown target triple 'unknown'
panicked at bindgen/ir/context.rs:562:15:
libclang error; possible causes include:
- Invalid flag syntax
- Unrecognized flags
- Invalid flag arguments
- File I/O errors
- Host vs. target architecture mismatch
Acked-by: Miguel Ojeda <ojeda@...nel.org>
Signed-off-by: Asuna Yang <SpriteOvO@...il.com>
---
scripts/Makefile.rust | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/Makefile.rust b/scripts/Makefile.rust
index 5c12b4b8c8b6..b219244cd051 100644
--- a/scripts/Makefile.rust
+++ b/scripts/Makefile.rust
@@ -6,4 +6,8 @@ BINDGEN_TARGET_loongarch := loongarch64-linux-gnusf
BINDGEN_TARGET_um := $(BINDGEN_TARGET_$(SUBARCH))
BINDGEN_TARGET := $(BINDGEN_TARGET_$(SRCARCH))
+ifeq ($(BINDGEN_TARGET),)
+$(error add '--target=' option to scripts/Makefile.rust)
+else
export BINDGEN_TARGET
+endif
--
2.51.1
Powered by blists - more mailing lists