rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Mainline loongarch64 defconfig+Rust build error
@ 2025-12-09 10:56 Miguel Ojeda
  2025-12-09 11:28 ` Xi Ruoyao
  2025-12-09 12:20 ` hev
  0 siblings, 2 replies; 6+ messages in thread
From: Miguel Ojeda @ 2025-12-09 10:56 UTC (permalink / raw)
  To: Huacai Chen, WANG Xuerui, Alice Ryhl, Greg Kroah-Hartman,
	Arve Hjønnevåg, Todd Kjos, Christian Brauner,
	Carlos Llamas
  Cc: Björn Roy Baron, Danilo Krummrich, Benno Lossin, Boqun Feng,
	Andreas Hindborg, Trevor Gross, loongarch, rust-for-linux,
	linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mainline loongarch64 defconfig+Rust build error
  2025-12-09 10:56 Mainline loongarch64 defconfig+Rust build error Miguel Ojeda
@ 2025-12-09 11:28 ` Xi Ruoyao
  2025-12-09 12:17   ` Gary Guo
  2025-12-09 12:20 ` hev
  1 sibling, 1 reply; 6+ messages in thread
From: Xi Ruoyao @ 2025-12-09 11:28 UTC (permalink / raw)
  To: Miguel Ojeda, Huacai Chen, WANG Xuerui, Alice Ryhl,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Christian Brauner, Carlos Llamas
  Cc: Björn Roy Baron, Danilo Krummrich, Benno Lossin, Boqun Feng,
	Andreas Hindborg, Trevor Gross, loongarch, rust-for-linux,
	linux-kernel

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.

-- 
Xi Ruoyao <xry111@xry111.site>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mainline loongarch64 defconfig+Rust build error
  2025-12-09 11:28 ` Xi Ruoyao
@ 2025-12-09 12:17   ` Gary Guo
  0 siblings, 0 replies; 6+ messages in thread
From: Gary Guo @ 2025-12-09 12:17 UTC (permalink / raw)
  To: Xi Ruoyao
  Cc: Miguel Ojeda, Huacai Chen, WANG Xuerui, Alice Ryhl,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Christian Brauner, Carlos Llamas, Björn Roy Baron,
	Danilo Krummrich, Benno Lossin, Boqun Feng, Andreas Hindborg,
	Trevor Gross, loongarch, rust-for-linux, linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mainline loongarch64 defconfig+Rust build error
  2025-12-09 10:56 Mainline loongarch64 defconfig+Rust build error Miguel Ojeda
  2025-12-09 11:28 ` Xi Ruoyao
@ 2025-12-09 12:20 ` hev
  2025-12-11  1:24   ` Alice Ryhl
  1 sibling, 1 reply; 6+ messages in thread
From: hev @ 2025-12-09 12:20 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Huacai Chen, WANG Xuerui, Alice Ryhl, Greg Kroah-Hartman,
	Arve Hjønnevåg, Todd Kjos, Christian Brauner,
	Carlos Llamas, Björn Roy Baron, Danilo Krummrich,
	Benno Lossin, Boqun Feng, Andreas Hindborg, Trevor Gross,
	loongarch, rust-for-linux, linux-kernel

On Tue, Dec 9, 2025 at 6:58 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> 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),

It looks like the rust binder driver also needs to handle
!CONFIG_COMPAT. Here's a reference for that:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/rust/kernel/miscdevice.rs?h=v6.18#n410

>       |                                      ^^^^^^^^^^^^^^^^ 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
>

--
hev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mainline loongarch64 defconfig+Rust build error
  2025-12-09 12:20 ` hev
@ 2025-12-11  1:24   ` Alice Ryhl
  2025-12-11  1:26     ` Alice Ryhl
  0 siblings, 1 reply; 6+ messages in thread
From: Alice Ryhl @ 2025-12-11  1:24 UTC (permalink / raw)
  To: hev
  Cc: Miguel Ojeda, Huacai Chen, WANG Xuerui, Greg Kroah-Hartman,
	Arve Hjønnevåg, Todd Kjos, Christian Brauner,
	Carlos Llamas, Björn Roy Baron, Danilo Krummrich,
	Benno Lossin, Boqun Feng, Andreas Hindborg, Trevor Gross,
	loongarch, rust-for-linux, linux-kernel

On Tue, Dec 09, 2025 at 08:20:46PM +0800, hev wrote:
> On Tue, Dec 9, 2025 at 6:58 PM Miguel Ojeda
> <miguel.ojeda.sandonis@gmail.com> 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),
> 
> It looks like the rust binder driver also needs to handle
> !CONFIG_COMPAT. Here's a reference for that:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/rust/kernel/miscdevice.rs?h=v6.18#n410

Yeah, it just needs a `#[cfg(CONFIG_COMPAT)] like miscdevice. Do you
want to add it? Otherwise I'll get to it soon.

Alice

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mainline loongarch64 defconfig+Rust build error
  2025-12-11  1:24   ` Alice Ryhl
@ 2025-12-11  1:26     ` Alice Ryhl
  0 siblings, 0 replies; 6+ messages in thread
From: Alice Ryhl @ 2025-12-11  1:26 UTC (permalink / raw)
  To: hev
  Cc: Miguel Ojeda, Huacai Chen, WANG Xuerui, Greg Kroah-Hartman,
	Arve Hjønnevåg, Todd Kjos, Christian Brauner,
	Carlos Llamas, Björn Roy Baron, Danilo Krummrich,
	Benno Lossin, Boqun Feng, Andreas Hindborg, Trevor Gross,
	loongarch, rust-for-linux, linux-kernel

On Thu, Dec 11, 2025 at 10:24 AM Alice Ryhl <aliceryhl@google.com> wrote:
>
> On Tue, Dec 09, 2025 at 08:20:46PM +0800, hev wrote:
> > On Tue, Dec 9, 2025 at 6:58 PM Miguel Ojeda
> > <miguel.ojeda.sandonis@gmail.com> 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),
> >
> > It looks like the rust binder driver also needs to handle
> > !CONFIG_COMPAT. Here's a reference for that:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/rust/kernel/miscdevice.rs?h=v6.18#n410
>
> Yeah, it just needs a `#[cfg(CONFIG_COMPAT)] like miscdevice. Do you
> want to add it? Otherwise I'll get to it soon.
Oh looks like there is already a patch for it.

Alice

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-12-11  1:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-09 10:56 Mainline loongarch64 defconfig+Rust build error Miguel Ojeda
2025-12-09 11:28 ` Xi Ruoyao
2025-12-09 12:17   ` Gary Guo
2025-12-09 12:20 ` hev
2025-12-11  1:24   ` Alice Ryhl
2025-12-11  1:26     ` Alice Ryhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).