[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <30975f96-db5f-4072-a371-4ac252139e4e@iscas.ac.cn>
Date: Tue, 23 Dec 2025 20:46:51 +0800
From: Vivian Wang <wangruikang@...as.ac.cn>
To: Mingcong Bai <jeffbai@...c.io>, Asuna Yang <spriteovo@...il.com>,
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>,
Kexy Biscuit <kexybiscuit@...c.io>, Xi Ruoyao <xry111@...111.site>
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
Subject: Re: [PATCH v5 2/4] rust: generate a fatal error if BINDGEN_TARGET is
undefined
On 12/23/25 20:09, Mingcong Bai wrote:
> Hi Asuna,
>
> 在 2025/12/4 15:54, Asuna Yang 写道:
>> 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>
>
> Unfortunately, this broke build for MIPS and PowerPC, neither of which
> has support for Rust. I also feel as though it might be pointless to
> ask all architecture to define BINDGEN_TARGET, especially when such a
> target specification may not even exist upstream (in Rust or even in
> LLVM).
>
> As shown in the first patch, the original Makefile did not require
> this definition either (please do enlighten me).
Looks like the rust/ subdir is conditional on CONFIG_RUST, so the
original rust/Makefile didn't have this problem.
Fixing this should be as simple as moving the check into rust/Makefile
instead.
Vivian "dramforever" Wang
Powered by blists - more mailing lists