From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 675363451C1 for ; Tue, 6 Jan 2026 19:36:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767728182; cv=none; b=Rezm3MS9LxTfezBCJESYKoTaa9BLrufbs4iybuEdNyMo/CK+reVzTAd0UIZ/+PJfW4+MlncQp0C5AglwfgFSEPfxbTRx0ZEblf3T3W2gSYinUQOKLRtAM9N4T07IGVa6Ak+y7Fn7I+Nvb10Lv/hmSVeOT2JzoiwtWBD4RaYFnw0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767728182; c=relaxed/simple; bh=6PEsWTJf0Vop6Q+1C1+DQ9N0VfM6GSa6BS4JsqEp9/k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=J2WbmAAwMYrWLXwZJaTyEhWSJL4PQ46xCEXO8mhh2aGx26j57AgMHDgwpdOtn25Du0VQG1Ft2GqmkX5VBHSVf80fBvJsQXWSfHkPGU+zxcpwABYqcDkv39uZTN8REp1INVWry0xdS9RNWTP+V1XO198IhWHSmssJnhwdEWBOIVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MSGp/YBQ; arc=none smtp.client-ip=209.85.210.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MSGp/YBQ" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-7cae2330765so29008a34.0 for ; Tue, 06 Jan 2026 11:36:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767728179; x=1768332979; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=ovwe6jVk+HZeAM9NHqCv6Ojkd+cynp9coM0xfvK8awk=; b=MSGp/YBQbb8kKsqd284/XlmPeQTN6eSPav7AOjqjbGWSKgFEXDvOLLSn/ciAwz4gsd pvY195SHNxV2LZc5OFMqllBLJo1fJ5UOICBln6+3HCK4PI6N6XuXV2+4HmsZeBOgRqpw xXBPQW9WFDUD4x5rs7ZqFCYUhHm2kHGOKWrBeef+B0Pq3Omr+k3gT3eVNcdJs3wh6jpO JnrTvneQAXK03VK43tMQEUj/ujHPVjCXP/pKf2zA3IApilVBvuvLbrS70R7MHTWR3Vgq K8Y3EKyKr/tgBOMAhBasY9QcnMk0ghDB0rJs9nOjeipmKjz73LNtcI2B/iWdI7KA7PYn 0KVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767728179; x=1768332979; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ovwe6jVk+HZeAM9NHqCv6Ojkd+cynp9coM0xfvK8awk=; b=FFpUzZERUjfSCBeGWObrAi5ys7uZG5pspJVxcOik7s4AM8tSQ5IIzV01BoCImHUiZW IY/zzfHfGTd7qW8APJ9wPYXy6lXGU91NzLawhvz62r3Gky4tJoHpew+gCdLVSOh6qb4Y 6sv9DXwfi794wMtYcDDis4mHpzQUzv/FPcySQIv56cRjCPC6I1pAcpDxldmhzj0maa5m oMotuwipRQ2vCWJXrJAlbEQG42SdrnNNaqXbuDgyElqwtIhnMtmLhqkLVZTqQom6jI9X uSlFEM1tstbDeucyKTXZ3/CmI8jLaKabR6V8s8ak5pBH4KkScaQkgoEwG3e22SDyVXpe 6TLQ== X-Forwarded-Encrypted: i=1; AJvYcCV3diJ/xyS5gz0EoTF8wKDkWoI+lLCpImjSXQtxhnyyKFL+a5oOIx0TYnKfvXWwrA+vUJqt4DPEpCXBDvc=@vger.kernel.org X-Gm-Message-State: AOJu0Yx0ne5720lfelyU6q4esbEJuJjX6RjYtc+9zFZSg+xn/OSWaLPo ha3dd9zNAL5Nz2pkcz2ws4Xqo21NN614i0c9aBwIAqVefLovPNK0iymhw/6gug== X-Gm-Gg: AY/fxX72kbCrlctlEgB9CnXtu83Y2spBjbKA0HGl5OxwNk/sO9Ti6YhYtkMJgMO1siY MbKN92FYv9Z++biPiTmYz7rlIQ34K3Hj/HhYVyiSn+MyEsn6G/Tf1R1PCuCtSRzSSXAOqVQmOVW E5BfS9Zs7GSDgSLqWJfEdoPugpFH4b0ELXTreCDwlu2mug9nTO/hrJwUpWRasBek1ckFLgVyf06 KoesngR7YeQ7MXARq9gLlnG93yVRRNE6Un7d2IWpG8oVUc/638Ls3FfFCKuNBxTdqRsz2iu4sH8 GDmjVor5M90/+tlNMTmkU7gHwoauYcv/ptQJzQzECkKORZzFuLZjNdBW9mpRskqtWwtHdwkcNGQ etlNWCL8uIjj7C/X18fLz1oiLeLnaQ49mRb0arCUD1gLmw3V2wCJX+ScwIdXUnKxHCrCnLLh4s6 QYpkyaHYY= X-Google-Smtp-Source: AGHT+IEbARtwYBCflrCWKTw53xNWRQrwwKMztLSlcqOR+PG0C4vOryHl1746rHcmK2MtQJpFKJixLQ== X-Received: by 2002:a05:690c:ed5:b0:787:a126:5619 with SMTP id 00721157ae682-790a962f54emr28940977b3.11.1767721117146; Tue, 06 Jan 2026 09:38:37 -0800 (PST) Received: from localhost ([2601:346:0:79bd:6398:4432:5113:2b75]) by smtp.gmail.com with ESMTPSA id 00721157ae682-790ae603282sm5749857b3.13.2026.01.06.09.38.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 09:38:36 -0800 (PST) Date: Tue, 6 Jan 2026 12:38:36 -0500 From: Yury Norov To: Alice Ryhl Cc: Burak Emir , Andreas Hindborg , Miguel Ojeda , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Trevor Gross , Danilo Krummrich , 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 Message-ID: References: <20260105-bitops-find-helper-v2-1-ae70b4fc9ecc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Jan 06, 2026 at 10:03:10AM +0100, Alice Ryhl wrote: > On Mon, Jan 5, 2026 at 6:03 PM Yury Norov 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:(::insert_or_update_handle) in archive vmlinux.a > > > >>> referenced by rust_binder_main.43196037ba7bcee1-cgu.0 > > > >>> drivers/android/binder/rust_binder_main.o:(::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 > > > Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/x/topic/x/near/561677301 > > > Signed-off-by: Alice Ryhl > > > > 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