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.

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.

Fixes: a647a0ff4c4e ("meson: correct bindgen_clang_argments")
Signed-off-by: Walter Werner Schneider <[email protected]>
---
 meta/classes-recipe/meson.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/classes-recipe/meson.bbclass 
b/meta/classes-recipe/meson.bbclass
index 9bed293603..8a37aa45ed 100644
--- a/meta/classes-recipe/meson.bbclass
+++ b/meta/classes-recipe/meson.bbclass
@@ -59,11 +59,14 @@ 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}'
     # 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()\n    localdata.setVar('TCOVERRIDE', 
'toolchain-clang');
+    items = localdata.expand(args).split()
     return repr(items[0] if len(items) == 1 else items)
 
 addtask write_config before do_configure

---
base-commit: 4a72f62d32e3fd3a88c2b92671f6dd75ef35fc44
change-id: 20260604-fix-rust-bindgen-for-big-little-arch-34788066c4ae

Best regards,
-- 
Walter Werner Schneider <[email protected]>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#239826): 
https://lists.openembedded.org/g/openembedded-core/message/239826
Mute This Topic: https://lists.openembedded.org/mt/120037525/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to