Hi Walter,
On 6/29/26 11:41 PM, Walter Werner SCHNEIDER via lists.openembedded.org
wrote:
The Rust bindgen uses libclang to parse target headers, so the arguments
passed to bindgen_clang_arguments must be valid clang arguments.
Changing TCOVERRIDE to toolchain-clang applies various fixes to those
arguments, including big.LITTLE architecture values fix for -mcpu.
Please remember someone (possibly you) is going to read this commit in a
few years without context, so it'd be nice to explain what the issue is
and why that fixes it. See the attempt I made in the original patch[1],
maybe you can borrow some of it or improve it.
[1]
https://lore.kernel.org/openembedded-core/[email protected]/
Note that the target attribute depends on the system beeing built for,
it is either the host system, the target system or the SDK system.
I don't understand to what this sentence applies in the diff.
Fixes: a647a0ff4c4e ("meson: correct bindgen_clang_argments")
Signed-off-by: Walter Werner Schneider <[email protected]>
---
I'm testing in a different repo clone, so I botched the code before
sending to the mailing list.
Changes in v2:
- Fixed new line escape.
- Link to v1:
https://lore.kernel.org/r/20260629-fix-rust-bindgen-for-big-little-arch-v1-1-7f7d70c9d...@schnwalter.eu
---
meta/classes-recipe/meson.bbclass | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/meta/classes-recipe/meson.bbclass
b/meta/classes-recipe/meson.bbclass
index 9bed293603..238c418e26 100644
--- a/meta/classes-recipe/meson.bbclass
+++ b/meta/classes-recipe/meson.bbclass
@@ -59,11 +59,15 @@ def rust_tool(d, target_var):
return "rust = %s" % repr(cmd)
def bindgen_args(d):
- args = '${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} --target=${TARGET_SYS}'
+ args = '${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} --target=${HOST_SYS}'
Try to avoid changing small things that are seemingly unrelated, or
explicitly document the change in the commit log if it is required, here
the added whitespace seems a good candidate for unrelated change. Except
in meta/classes-recipe/cmake.bbclass, TOOLCHAIN_OPTIONS never has a
whitespace before the variable is used (the variable seems to have a
leading space when it's defined, that might explain why).
I couldn't get from the commit log why we need to change from TARGET_SYS
to HOST_SYS. Can you explain?
# For SDK packages TOOLCHAIN_OPTIONS don't contain full sysroot path
if bb.data.inherits_class("nativesdk", d):
args += '
--sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE}${prefix_nativesdk}'
- items = d.expand(args).split()
+ # Rust bindgen uses libclang under the hood. Apply variable overrides for
+ # clang; Fixes big.LITTLE -mcpu values.
+ localdata = d.createCopy()
+ localdata.setVar('TCOVERRIDE', 'toolchain-clang');
I think we should make sure the copy is done before we check if
bb.data.inherits_class("nativesdk", X) because it could be that someone
has made some "interesting" design choices of inheriting nativesdk only
for clang and not gcc. Theoretical and very unlikely scenario but who
knows, better have sound logic here.
I don't know if it's worth it, but you could avoid a datastore copy if
TCOVERRIDE already is toolchain-clang. See
https://lore.kernel.org/openembedded-core/[email protected]/
Thanks for looking into it!
Cheers,
Quentin
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#239869):
https://lists.openembedded.org/g/openembedded-core/message/239869
Mute This Topic: https://lists.openembedded.org/mt/120038274/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-