]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
rust-target-config: Make target workaround generic
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 5 Aug 2022 13:05:18 +0000 (14:05 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 8 Aug 2022 14:41:36 +0000 (15:41 +0100)
Ensure the 'target' data is set for both HOST and TARGET queries
as appropriate to work correctly in cross configurations.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/rust-target-config.bbclass

index bc6bd77abbf6c7c152784323851f54e3e4e05a56..0f0797603e15f36182d583e904ae7e62259cffd6 100644 (file)
@@ -290,6 +290,10 @@ llvm_cpu[vardepvalue] = "${@llvm_cpu(d)}"
 
 def rust_gen_target(d, thing, wd, arch):
     import json
+
+    build_sys = d.getVar('BUILD_SYS')
+    target_sys = d.getVar('TARGET_SYS')
+
     sys = d.getVar('{}_SYS'.format(thing))
     prefix = d.getVar('{}_PREFIX'.format(thing))
     rustsys = d.getVar('RUST_{}_SYS'.format(thing))
@@ -298,7 +302,9 @@ def rust_gen_target(d, thing, wd, arch):
     cpu = "generic"
     features = ""
 
-    if thing == "TARGET":
+    # Need to apply the target tuning consitently, only if the triplet applies to the target
+    # and not in the native case
+    if sys == target_sys and sys != build_sys:
         abi = d.getVar('ABIEXTENSION')
         cpu = llvm_cpu(d)
         if bb.data.inherits_class('native', d):