mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gary Guo <gary@garyguo.net>
To: Xi Ruoyao <xry111@xry111.site>
Cc: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	"Huacai Chen" <chenhuacai@kernel.org>,
	"WANG Xuerui" <kernel@xen0n.name>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Christian Brauner" <christian@brauner.io>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Benno Lossin" <lossin@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	loongarch@lists.linux.dev,
	rust-for-linux <rust-for-linux@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Mainline loongarch64 defconfig+Rust build error
Date: Tue, 9 Dec 2025 12:17:05 +0000	[thread overview]
Message-ID: <20251209121705.7f6c1117.gary@garyguo.net> (raw)
In-Reply-To: <fb77069524eec1df222b2ecbc6ddf5c3b4b041bb.camel@xry111.site>

On Tue, 09 Dec 2025 19:28:33 +0800
Xi Ruoyao <xry111@xry111.site> wrote:

> On Tue, 2025-12-09 at 11:56 +0100, Miguel Ojeda wrote:
> > Hi all,
> > 
> > I am seeing in mainline loongarch64 defconfig+Rust the following build
> > error [1].
> > 
> > Cheers,
> > Miguel
> > 
> > [1]
> > 
> >  error[E0425]: cannot find value `compat_ptr_ioctl` in crate `bindings`
> >      --> drivers/android/binder/rust_binder_main.rs:317:38
> >       |
> > 317   |         compat_ioctl: Some(bindings::compat_ptr_ioctl),
> >       |                                      ^^^^^^^^^^^^^^^^ help: a
> > function with a similar name exists: `compat_sys_ioctl`
> >       |
> >      ::: /__w/quick/quick/linux/rust/bindings/bindings_generated.rs:78264:5
> >       |
> > 78264 |     pub fn compat_sys_ioctl(fd: ffi::c_uint, cmd: ffi::c_uint,
> > arg: compat_ulong_t) -> ffi::c_long;
> >       |     ----------------------------------------------------------------------------------------------
> > similarly named function `compat_sys_ioctl` defined here  
> 
> I highly doubt if this is really a LoongArch-only issue.  We have:
> 
> #ifdef CONFIG_COMPAT
> extern long compat_ptr_ioctl(struct file *file, unsigned int cmd, 
>                     unsigned long arg);
> #else
> #define compat_ptr_ioctl NULL
> #endif
> 
> AFAIK bindgen does not translate C preprocessor macro definitions, so
> when !CONFIG_COMPAT we won't have the Rust binding for it.
> 
> And as LA32 is not upstreamed it's pointless to support COMPAT for
> LoongArch, yet.
> 

I think bindgen can't handle this on its own anyway, as it doesn't
really know that you want a `Option<fn(..) -> ...>` type here instead
of just a function item.

Probably the best way is for each user of this function handle
CFG_COMPAT on its own for now. Alternatively, we can just provide a
helper that just returns `-ENONIOCTLCMD` instead of using NULL?

Besat,
Gary

  reply	other threads:[~2025-12-09 12:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09 10:56 Miguel Ojeda
2025-12-09 11:28 ` Xi Ruoyao
2025-12-09 12:17   ` Gary Guo [this message]
2025-12-09 12:20 ` hev
2025-12-11  1:24   ` Alice Ryhl
2025-12-11  1:26     ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251209121705.7f6c1117.gary@garyguo.net \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=arve@android.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=chenhuacai@kernel.org \
    --cc=christian@brauner.io \
    --cc=cmllamas@google.com \
    --cc=dakr@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tkjos@android.com \
    --cc=tmgross@umich.edu \
    --cc=xry111@xry111.site \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®