@@ -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()
+ # Use the LLVM Linux target triple for all toolchains instead of -mcpu.
+ # Note: The big.LITTLE CPU architectures are not supported by llvm/clang.
+ items = [item for item in items if not item.startswith('-mcpu')]
return repr(items[0] if len(items) == 1 else items)
addtask write_config before do_configure
bindgen uses libclang to parse target headers, so the arguments passed in bindgen_clang_arguments must be valid clang arguments. Some GCC toolchains emit -mcpu values for big.LITTLE Arm CPUs that clang/llvm does not support, which breaks recipes using bindgen, for example Mesa with Rusticl enabled. The -mcpu option only selects CPU-specific tuning/code generation and is not required when generating Rust bindings. The target triple is sufficient for clang to select the correct target ABI and parse the headers. Drop -mcpu from the bindgen arguments and rely on the target triple instead. 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 <contact@schnwalter.eu> --- meta/classes-recipe/meson.bbclass | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- base-commit: 1e86aa039108621b2af734ef358a1e9d3c4d88d8 change-id: 20260604-fix-rust-bindgen-for-big-little-arch-78e45e8fefa1 Best regards,