public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Burak Emir" <bqe@google.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] rust: bitops: fix missing _find_* functions on 32-bit ARM
Date: Tue, 6 Jan 2026 12:38:36 -0500	[thread overview]
Message-ID: <aV1InE2bnTLYnMAC@yury> (raw)
In-Reply-To: <CAH5fLgjtXHH40Pcw=ZoOKPzvJzDA8fohNtC6W6DsfkcE-6vtrQ@mail.gmail.com>

On Tue, Jan 06, 2026 at 10:03:10AM +0100, Alice Ryhl wrote:
> On Mon, Jan 5, 2026 at 6:03 PM Yury Norov <yury.norov@gmail.com> wrote:
> >
> > On Mon, Jan 05, 2026 at 10:44:06AM +0000, Alice Ryhl wrote:
> > > atus: O
> > > Content-Length: 4697
> > > Lines: 121
> > >
> > > On 32-bit ARM, you may encounter linker errors such as this one:
> > >
> > >       ld.lld: error: undefined symbol: _find_next_zero_bit
> > >       >>> referenced by rust_binder_main.43196037ba7bcee1-cgu.0
> > >       >>>               drivers/android/binder/rust_binder_main.o:(<rust_binder_main::process::Process>::insert_or_update_handle) in archive vmlinux.a
> > >       >>> referenced by rust_binder_main.43196037ba7bcee1-cgu.0
> > >       >>>               drivers/android/binder/rust_binder_main.o:(<rust_binder_main::process::Process>::insert_or_update_handle) in archive vmlinux.a
> > >
> > > This error occurs because even though the functions are declared by
> > > include/linux/find.h, the definition is #ifdef'd out on 32-bit ARM. This
> > > is because arch/arm/include/asm/bitops.h contains:
> > >
> > >       #define find_first_zero_bit(p,sz)       _find_first_zero_bit_le(p,sz)
> > >       #define find_next_zero_bit(p,sz,off)    _find_next_zero_bit_le(p,sz,off)
> > >       #define find_first_bit(p,sz)            _find_first_bit_le(p,sz)
> > >       #define find_next_bit(p,sz,off)         _find_next_bit_le(p,sz,off)
> > >
> > > And the underscore-prefixed function is conditional on #ifndef of the
> > > non-underscore-prefixed name, but the declaration in find.h is *not*
> > > conditional on that #ifndef.
> > >
> > > To fix the linker error, we ensure that the symbols in question exist
> > > when compiling Rust code. We do this by definining them in rust/helpers/
> > > whenever the normal definition is #ifndef'd out.
> > >
> > > Note that these helpers are somewhat unusual in that they do not have
> > > the rust_helper_ prefix that most helpers have. Adding the rust_helper_
> > > prefix does not compile, as 'bindings::_find_next_zero_bit()' will
> > > result in a call to a symbol called _find_next_zero_bit as defined by
> > > include/linux/find.h rather than a symbol with the rust_helper_ prefix.
> > > This is because when a symbol is present in both include/ and
> > > rust/helpers/, the one from include/ wins under the assumption that the
> > > current configuration is one where that helper is unnecessary. This
> > > heuristic fails for _find_next_zero_bit() because the header file always
> > > declares it even if the symbol does not exist.
> > >
> > > The functions still use the __rust_helper annotation. This lets the
> > > wrapper function be inlined into Rust code even if full kernel LTO is
> > > not used once the patch series for that feature lands.
> > >
> > > Cc: stable@vger.kernel.org
> > > Fixes: 6cf93a9ed39e ("rust: add bindings for bitops.h")
> > > Reported-by: Andreas Hindborg <a.hindborg@kernel.org>
> > > Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/x/topic/x/near/561677301
> > > Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> >
> > Which means, you're running active testing, which in turn means that
> > Rust is in a good shape indeed. Thanks to you and Andreas for the work.
> 
> I've put together this collection of GitHub actions jobs that build
> and test a few common configurations, which I used to test this:
> https://github.com/Darksonn/linux
> 
> > Before I merge it, can you also test m68k build? Arm and m68k are the
> > only arches implementing custom API there.
> 
> I ran a gcc build for m68k with these patches applied and it built
> successfully for me.

Thanks, Alice! Added in -next for testing. I'm going to send PR with the
next -rc as it's a real build fix.

Dirk and everyone, please send your tags before the end of the week, if
you want.

Thanks,
Yury

  reply	other threads:[~2026-01-06 19:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05 10:44 [PATCH v2] rust: bitops: fix missing _find_* functions on 32-bit ARM Alice Ryhl
2026-01-05 17:03 ` Yury Norov
2026-01-05 17:08   ` Miguel Ojeda
2026-01-06  9:03   ` Alice Ryhl
2026-01-06 17:38     ` Yury Norov [this message]
2026-01-07  5:31       ` Dirk Behme
2026-01-06  8:48 ` Dirk Behme
2026-01-06 10:47 ` Andreas Hindborg

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=aV1InE2bnTLYnMAC@yury \
    --to=yury.norov@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=bqe@google.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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